Repository navigation
Keep one request-response class for models that reach a readOnly model only through map keywords they do not type - #5275
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05243ec04b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
Merging this PR will degrade performance by 12.22%1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…l only through map keywords they do not type Under --read-only-write-only-model-type request-response the schema graph decided that a model needs variants from keywords its model does not type, so the model kept one class while the references to it read Request/Response variants that were never generated, and generation failed with "A Parser can not resolve classes": - A $ref with properties beside it merges the map it names into a model with fields, which types none of the map's patternProperties or additionalProperties, but the graph read the reference to the map as a reference of the model. - The additionalProperties of an inline allOf member, or beside an allOf that builds a model with fields or bases, type nothing there (beside fields only pydantic v2 BaseModel and TypedDict write their type), but the graph read them wherever the member or the schema declared no properties of its own, and for pydantic v2 BaseModel and TypedDict in every inline member. The graph now decides with the rule the allOf parse applies (an allOf merges into one map only where every item is an object map), and where a $ref names a map that the merged schema does not build, it reads the merged schema in place of the reference: those models keep one class, as without the option, and only the readOnly model and the maps that type it split. The schema graph check test reads a schema whose customTypePath types a reference, which still splits this way. Fixes: #5237
05243ec to
ffa677b
Compare
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The PR changes only internal private helpers in the JSON Schema parser. It replaces _merged_ref_model_schema with _merged_ref_model_schemas and adds _schema_builds_map_model, _has_map_keywords and _is_all_of_mapping_item. These are used by the read/write schema graph walk that decides request/response splits under the opt-in --dedupe-request-response-variants flag. The fix stops the walk from treating map keywords as typing anything when the generated model does not type them. That covers patternProperties, propertyNames and additionalProperties beside properties or an allOf that builds a model with fields. As a result, those models keep one class under dedupe, just as they already did without the flag. The new tests check that the dedupe and default runs give identical output for every output model type, so default behavior is unchanged. Moving the allOf mapping-item check into _is_all_of_mapping_item is a pure refactor with the same logic. The schema graph check test now uses a customTypePath fixture only because the old fixture no longer triggers the mismatch, which reflects the bug fix rather than a change in how errors are reported. No CLI options, public API, templates, defaults or Python version support were removed or changed. This analysis was produced by the release draft workflow |
Fixes: #5237
Summary by CodeRabbit