Repository navigation
Read --intersect-allof-keywords in one place, as four named legacy rows of the intersection core - #5423
Conversation
… core with named legacy rows
…rds read and list its four legacy rows
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Shared intersection policy src/datamodel_code_generator/parser/_intersection.py, scripts/decision_homes.toml, docs/architecture.md |
The shared intersection module defines keyword and legacy-row constants. intersect_keywords accepts legacy rows and returns the original row when legacy-merge-row is present. The decision records document the adapter and legacy rows. |
AllOf parsing behavior src/datamodel_code_generator/parser/jsonschema.py, scripts/decision_homes.toml |
JsonSchemaParser uses legacy rows to control null handling, pattern conjunction, allOf value-site forms, inherited-field merging, and enum intersection. The decision-home allowlist records affected parser functions. |
Reference-sibling merging src/datamodel_code_generator/parser/jsonschema.py, src/datamodel_code_generator/parser/openapi.py |
Both parsers use _merges_ref_siblings to determine when to merge $ref siblings with schema keywords. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Possibly related issues
- datamodel-code-generator/datamodel-code-generator#5421: The PR updates the architecture documentation to name the legacy rows and their parser adapters.
Possibly related PRs
- datamodel-code-generator/datamodel-code-generator#5406: Both changes address allOf root-value handling under the intersection policy.
- datamodel-code-generator/datamodel-code-generator#5328: Both changes cover allOf value-site behavior for arrays and object maps.
- datamodel-code-generator/datamodel-code-generator#5394: Both changes use the
$refsibling dialect decision to control sibling-keyword merging.
Merge Risk: 
Minimal · previous review 54647
-
The refactor centralizes intersection policy without an identified behavior regression. No actionable merge-blocking risk remains; normal checks should pass before merging.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title accurately identifies the main change: centralizing the --intersect-allof-keywords read and naming the four legacy intersection rows. It is specific and related to the pull request objectives.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% 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 2 functions across 2 files. (3 skipped: 2 unsupported, 1 too large.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- 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 33.99%2 warnings
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! |
…e before rewriting the allowlist, literal False exclusion keywords
Breaking Change AnalysisResult: No breaking changes detected Reasoning: This PR is an internal refactor and changes nothing for users by default. Every direct read of intersects_allof_keywords in the JSON Schema parser now goes through a new cached _legacy_intersection set. That set holds four named legacy rows (legacy-merge-row, legacy-lookahead-patterns, legacy-all-of-site-form, legacy-all-of-null-as-written) and contains all of them unless --intersect-allof-keywords is passed. I traced each rewritten condition under default options and each one gives the same result as before. The _null_mode flag type_excludes_member_null is still false. The ref-sibling and inherited-property merges still return the earlier merge row, because intersect_keywords returns it under legacy-merge-row. Pattern joining still uses lookaheads. The allOf site form, the null_member and FIELDLESS_SITE_KEY marking, and the array allOf path are unchanged too: the array path now calls _all_of_root_value_schema, but that function still returns None at once for arrays in legacy mode. The other edits are equivalent rewrites: repeated has_ref_with_schema_keywords checks are replaced by the existing _merges_ref_siblings helper, some literal-equality loops now use intersect_enum_values, and the row dict is built with a comprehension. The API changes are limited to private members. _intersect_parts and _all_of_value_schema are removed, and the module constant _INTERSECTED_KEYWORDS moves to _intersection.py as INTERSECTED_KEYWORDS. intersect_keywords gains an optional keyword-only legacy_rows parameter that defaults to an empty tuple. The other changes are documentation, decision-home tooling and its tests. The behaviour diff gate does show accepted cells, but it compares the PR build with the last release, so it includes earlier unreleased changes. Its notes credit those cells to an earlier PR (the allOf sites whose parts admit no object). It also flags an unrelated crash-fix cell about module import names, which confirms the gate covers changes beyond this PR. The code those accepted cells depend on is already in the removed lines with the same default behaviour, so this PR did not cause them. 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. |
Byte-identical refactor (A2 of the decision-home plan).
Summary by CodeRabbit
--intersect-allof-keywordsis disabled, including$refsiblings, inherited overrides, pattern constraints,allOfvalue forms, and null handling.$refsiblings.