Repository navigation
Move the schema reading helpers the JSON Schema parser concerns share into a module of their own - #5639
Conversation
… into a module of their own
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared schema-reading helpers src/datamodel_code_generator/parser/_schema_reading.py, src/datamodel_code_generator/parser/jsonschema.py, src/datamodel_code_generator/parser/_null_facts.py, scripts/decision_homes.toml, docs/architecture.md |
Shared schema-reading helpers move into _schema_reading.py. jsonschema.py, the decision-home configuration, and documentation refer to the extracted helpers. |
Schema-validation helpers src/datamodel_code_generator/parser/_schema_validators.py, src/datamodel_code_generator/parser/jsonschema.py, scripts/decision_homes.toml, docs/architecture.md |
Schema implication, conditional-property, and pattern-validation helpers move into _schema_validators.py. Parser methods delegate to them, and SchemaValidatorsHost declares parser interfaces used by the helper logic. |
Object-map parsing helpers src/datamodel_code_generator/parser/_object_maps.py, src/datamodel_code_generator/parser/jsonschema.py, docs/architecture.md |
Object-map schema handling moves into _object_maps.py. The parser delegates extra-field lookup, root-field creation, key typing, and map-type union operations to the extracted helpers. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Possibly related PRs
- datamodel-code-generator/datamodel-code-generator#5632: Adds the same
_schema_validators.pymodule andSchemaValidatorsHostprotocol with overlapping contents. - datamodel-code-generator/datamodel-code-generator#5631: Adds the same
_object_maps.pymodule and object-map helpers with overlapping contents.
Merge Risk: 
Minimal · up to 45474
-
No actionable merge-blocking issue is identified. The helper extraction appears mergeable subject to normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title says the PR moves schema-reading helpers shared by the JSON Schema parser into their own module. The changeset matches this. It adds parser/_schema_reading.py as the shared home for these helpers. It removes many helpers from jsonschema.py, and the docs and H03 config point to the new module. The title is specific and describes the main change. It does not describe the secondary work on _schema_validators.py and _object_maps.py, which is expected.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 92.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 25 functions across 4 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 49.9%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! |
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The diff is an internal refactor that moves code between modules: module-level helpers of parser/jsonschema.py move into a new parser/_schema_reading.py module, and several JsonSchemaParser method bodies move into functions in parser/_object_maps.py and parser/_schema_validators.py; each moved body matches the deleted original apart from renaming self to parser, so generated output cannot change. The only removals are private: the JsonSchemaParser methods _pattern_checks_declared_key, _get_additional_properties_root_field and _object_map_type_union, plus underscore-prefixed module helpers, while the public re-exports INTERSECTED_KEYWORDS, bounds_admit_no_value and intersect_keywords are explicitly kept. The other files are docs and the internal decision_homes.toml config, with no changes to CLI options, templates, error handling or Python version support. The behaviour gate does list accepted cells for allOf schemas whose parts admit no object, which now generate RootModel or alias types, but the gate compares against the last release and its note names a different cause, while this diff copies the allOf intersection helpers over unchanged, so those changes come from other work and not from this PR. 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