Skip to content

Keep generated Hashable conformance only for public models#4163

Merged
laevandus merged 3 commits into
developfrom
open-api-hashable-models
Jul 9, 2026
Merged

Keep generated Hashable conformance only for public models#4163
laevandus merged 3 commits into
developfrom
open-api-hashable-models

Conversation

@laevandus

@laevandus laevandus commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🔗 Issue Links

Related: CHA-3742

🎯 Goal

The OpenAPI generator now emits a Hashable conformance for every model; keep it only for the publicly exposed models (AppSettings, UploadConfig) and strip it from the rest to avoid shipping unused API surface.

📝 Summary

  • Publicize the generated Hashable conformance for AppSettings/UploadConfig and add an allowed_hashable_models allow-list in openapi_generate.sh that strips the Hashable extension from all other generated models.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Documentation has been updated in the docs-content repo

Summary by CodeRabbit

  • Bug Fixes
    • Improved generated model support so only approved models keep hashability, avoiding inconsistent behavior across model types.
    • Ensured generated equality and hashing behavior remains accessible where needed, improving compatibility with code that stores these models in sets or dictionaries.

laevandus added 2 commits July 8, 2026 10:08
Regenerate models with the current generator, which now emits a Hashable
conformance for each model. For the models we expose ourselves (AppSettings,
UploadConfig), publicize_model now also makes the == and hash(into:)
requirements public so the conformance is usable outside the module.
@laevandus
laevandus requested a review from a team as a code owner July 8, 2026 08:28
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Modifies the OpenAPI generation script to introduce an allowlist controlling which generated model types retain Hashable conformance, publicize the generated == operator and hash(into:) method, and strip Hashable extensions from non-allowlisted models via sed.

Changes

OpenAPI Generator Script Updates

Layer / File(s) Summary
Hashable allowlist and conformance stripping
Scripts/openapi_generate.sh
Adds allowed_hashable_models array and a new strip_hashable_conformance step that uses sed to remove the generated Hashable extension from models not in the allowlist.
Publicize generated equality and hash methods
Scripts/openapi_generate.sh
Updates publicize_model to also mark the generated static func == and func hash(into:) as public, applied to AppSettings and UploadConfig.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: martinmitrevski, nuno-vieira

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: retaining generated Hashable conformance only for public models.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch open-api-hashable-models

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
1 Message
📖 There seems to be app changes but CHANGELOG wasn't modified.
Please include an entry if the PR includes user-facing changes.
You can find it at CHANGELOG.md.

Generated by 🚫 Danger

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Public Interface

+ extension AppSettings: Hashable  
+ 
+   public static func ==(lhs: AppSettings,rhs: AppSettings)-> Bool
+   public func hash(into hasher: inout Hasher)

+ extension UploadConfig: Hashable  
+ 
+   public static func ==(lhs: UploadConfig,rhs: UploadConfig)-> Bool
+   public func hash(into hasher: inout Hasher)



@Stream-SDK-Bot

Copy link
Copy Markdown
Collaborator

SDK Size

title develop branch diff status
StreamChat 7.53 MB 7.53 MB +1 KB 🟢
StreamChatUI 4.27 MB 4.27 MB 0 KB 🟢
StreamChatCommonUI 0.84 MB 0.84 MB 0 KB 🟢

@Stream-SDK-Bot

Copy link
Copy Markdown
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 5.01 ms 49.9% 🔼 🟢
Duration 2.6 s 2.37 s 8.85% 🔼 🟢
Hitch time ratio 4 ms per s 1.97 ms per s 50.75% 🔼 🟢
Frame rate 75 fps 80.7 fps 7.6% 🔼 🟢
Number of hitches 1 0.6 40.0% 🔼 🟢

@Stream-SDK-Bot

Copy link
Copy Markdown
Collaborator

StreamChat XCSize

Object Diff (bytes)
UploadConfig.o +11061
ChatMessageGiphyAttachment.o -10372
AppSettings.o +976
ChatMessageAttachment.o -48

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@laevandus
laevandus enabled auto-merge (squash) July 9, 2026 13:08
@laevandus
laevandus merged commit 2767e2a into develop Jul 9, 2026
21 checks passed
@laevandus
laevandus deleted the open-api-hashable-models branch July 9, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants