Repository navigation
Move the document reading of the JSON Schema parser into a module of its own and turn option values into arguments in one place - #5696
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Document loading and resource indexing src/datamodel_code_generator/parser/_schema_documents.py, src/datamodel_code_generator/parser/jsonschema.py, src/datamodel_code_generator/parser/_null_facts.py, docs/architecture.md, scripts/decision_homes.toml |
Schema document loading, resource registration, reference rewriting, and indexing move into _schema_documents. JsonSchemaParser delegates these operations, and architecture references identify the new locations. |
Source parsing and definition traversal src/datamodel_code_generator/parser/_schema_documents.py, src/datamodel_code_generator/parser/jsonschema.py |
Source iteration, loading, parsing, reserved-target lookup, and definition traversal move into _schema_documents; parser methods delegate to the extracted helpers. |
JSON Pointer reading src/datamodel_code_generator/parser/_schema_reading.py, src/datamodel_code_generator/parser/jsonschema.py, src/datamodel_code_generator/parser/_api_reference.py, docs/architecture.md |
_schema_reading provides URI-fragment decoding, pointer traversal and splitting, and schema-entry classification. Parser imports and the API reference use the shared helpers. |
Reference resolution and traversal src/datamodel_code_generator/parser/_schema_refs.py, src/datamodel_code_generator/parser/jsonschema.py, docs/architecture.md |
Reference reading, dynamic-reference analysis, recursive-reference resolution, and cycle traversal use module-level helpers in _schema_refs; parser methods delegate to them. |
Configuration and Recommendation Values
| Layer / File(s) | Summary |
|---|---|
Configuration values to CLI arguments src/datamodel_code_generator/_option_names.py, src/datamodel_code_generator/__main__.py, src/datamodel_code_generator/_recommend/*, scripts/recommender_calibrate.py, scripts/decision_homes.toml, docs/architecture.md |
values_arguments creates CLI arguments in input order and omits values without an expressible option. The CLI and recommendation reporting use this helper. |
Configured values and recommendation merging src/datamodel_code_generator/_option_names.py, src/datamodel_code_generator/_recommend/*, scripts/decision_homes.toml, docs/architecture.md |
configured_value supplies TOML-spelled values for comparisons and validation. _merged_values combines option mappings, with later values replacing earlier values for the same field. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Refactor
Possibly related issues
- Empty list or tuple option value is written as a bare flag in generated commands #5589: The pull request centralizes option-value-to-argument conversion, the area identified in the report of empty list values rendering as bare flags.
- fail-on-multi-module-stdout is written to generated pyproject config but ignored when read from pyproject.toml #5582: The pull request centralizes reading configured values from pyproject spelling, the area identified in the report of a setting not being applied when read from pyproject.toml.
Possibly related PRs
- datamodel-code-generator/datamodel-code-generator#5590: Both changes address the contract for converting option values into CLI arguments.
- datamodel-code-generator/datamodel-code-generator#5663: Both changes define how configured values use pyproject spelling in recommendation paths.
- datamodel-code-generator/datamodel-code-generator#5639: This pull request reuses JSON Schema reading helpers from
_schema_readingwhile extracting document loading into_schema_documents.
Merge Risk: 
Minimal · up to e8d26
-
No merge-blocking defect was identified in the parser extraction or configuration-value consolidation. Merge after normal checks pass.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title clearly summarizes both primary changes: moving JSON Schema document reading into its own module and centralizing option-value conversion into arguments. It is specific and related to the changeset.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 85.71% 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 70 functions across 12 files. (2 skipped: 2 unsupported.)
-
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 50.67%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 a behaviour-preserving internal refactor. Document-reading logic moves verbatim from parser/jsonschema.py into a new parser/_schema_documents.py module, the JSON pointer walk helpers move into parser/_schema_reading.py, and several reference helpers move into parser/_schema_refs.py. JsonSchemaParser keeps its delegating methods such as parse_ref, parse_id and the private load and iterate hooks, and parser.jsonschema still imports and re-exports the public names get_model_by_path, split_json_pointer and unescape_json_pointer_segment. Only underscore-prefixed private methods and imports were removed. The recommender and CLI changes consolidate repeated code into values_arguments, configured_value and _merged_values, which produce the same arguments in the same order with the same later-wins merge. The remaining changes are documentation and decision_homes.toml tooling config. The behaviour diff gate lists accepted cells where an allOf whose parts admit no object now becomes a RootModel or alias instead of an empty object model, but the gate compares against the last release and so includes earlier unreleased PRs. Its notes point to an earlier allOf intersection change, and nothing in this diff touches allOf handling, so those output changes do not come from this PR. No CLI options, public API, templates, defaults, Python version support or error handling change in this diff. 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