Repository navigation
Share the reference rebinding, the run arguments and the orderings of the structure, render preparation, settle and cross-module passes - #5572
Conversation
… the structure, render preparation, settle and cross-module passes
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared pass helpers and state src/datamodel_code_generator/parser/_passes/_shared.py, src/datamodel_code_generator/parser/_passes/_state.py, src/datamodel_code_generator/parser/_passes/_tables.py |
Shared module protocols and reference helpers were added or updated. Module-name assignment and pass-table calls were changed. |
Cross-module references and base classes src/datamodel_code_generator/parser/_passes/cross_module.py, src/datamodel_code_generator/parser/_passes/modules.py, src/datamodel_code_generator/parser/_passes/render_prep.py |
Cross-module passes use run contexts and shared reference-expression handling. Generic base-class assignment, import processing, and inherited-field reference updates were changed. |
Module grouping and circular imports src/datamodel_code_generator/parser/_passes/structure.py |
Structure processing now updates module indexes in place and filters stand-ins through a shared helper. Duplicate handling, internal-module naming, and circular-import ordering were also changed. |
Reference planning and render preparation src/datamodel_code_generator/parser/_passes/plans.py, src/datamodel_code_generator/parser/_passes/settle.py, src/datamodel_code_generator/parser/_passes/render_prep.py |
Circular-reference planning and model sorting were updated. Render preparation changes reference updates, default deserialization and warnings, constructor field sorting, and model collection. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Suggested labels: breaking-change-analyzed
Merge Risk: 
Minimal · up to 03c43
-
No actionable merge-blocking issue remains established for the parser-pass refactoring. Merge after normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the changed areas: reference rebinding, run arguments, and pass orderings in the structure, render preparation, settle, and cross-module passes. The raw summary supports this. It covers shared
set_reference_expressionsandwithout_stand_inshelpers,CrossModuleRunreplacing separate context arguments, and reordered sorting in structure, render_prep, settle, and cross_module. The title is long (135 characters, 19 words) and its wording is somewhat dense. Still, it refers to the main change and does not mislead.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 91.43% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 35 functions across 9 files.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
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. |
Merging this PR will degrade performance by 12.2%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! |
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The diff only touches private modules under parser/_passes and is a behaviour-preserving refactor. It adds a set_reference_expressions helper that replaces repeated set_reference_expression loops, using members=None wherever the old code passed same_module=False. It adds a without_stand_ins helper that replaces repeated stand-in filtering, and a ModuleNamesView protocol. It changes the cross_module pass functions (import_removed_reuse_canonicals, import_renamed_types, import_enum_member_literal_classes, apply_generic_base_class) to take the run object, wired up through late() in the pass table. It removes the internal ModuleContextFields alias and the live_models state field, and it moves _group_models_by_module and _index_module_models to writing into the state object. The rest is control-flow tidying with equivalent logic: _ModuleNames.assign, the settle sort branches, compute_internal_module_path, the root-module choice in apply_generic_base_class, record_decimal_default_warning, fix_constructor_field_ordering_of, create_shared_module_from_duplicates and resolve_circular_imports. None of this is a public CLI or Python API, a template, a default option value, a supported Python version or error reporting. The behaviour diff gate compares against the last release, so it is cumulative. Its accepted cells all concern allOf schemas whose parts admit no object, which used to become empty object models and now become root models or aliases, and their own notes attribute this to an earlier allOf change. Nothing in this diff touches allOf handling. The crash-fix cell does not change behaviour, and the both-fail cells fail before and after. So none of the default-output changes the gate shows come from this PR, and there are no breaking changes. This analysis was produced by the release draft workflow |
|
🎉 Released in 0.88.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit