Skip to content

Move the object map reading of the JSON Schema parser into a module of its own - #5631

Merged
Koudai Aono (koxudaxi) merged 1 commit into
impl-map3from
impl-map5
Oct 30, 2026
Merged

Koudai Aono (koxudaxi) merged 1 commit into
impl-map3from
impl-map5

Conversation

@koxudaxi

@koxudaxi Koudai Aono (koxudaxi) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Reorganized JSON Schema object-map parsing while retaining support for additional properties, nullable maps, pattern properties, property-name constraints, and eligible allOf schemas.
  • Documentation
    • Updated architecture guidance to reflect the current organization of object-map parsing and its documented hooks.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 87924c8eb94a9c0c9d8fa39738bfc2a339bc24f9 and 122d7d115a3ddc585f1bc32da069026743b4b70d.

Files ignored due to path filters: 1
  • docs/llms-full.txt is excluded by none and included by none
Files selected for processing: 5
  • docs/architecture.md
  • scripts/decision_homes.toml
  • src/datamodel_code_generator/parser/_null_facts.py
  • src/datamodel_code_generator/parser/_object_maps.py
  • src/datamodel_code_generator/parser/jsonschema.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

The PR moves JSON Schema object-map parsing helpers from JsonSchemaParser into a new _object_maps module. The parser delegates map construction and related schema decisions to that module. Architecture, null-facts, and decision-home references now point to the extracted helpers.

Changes: Object-map parsing extraction

Layer / File(s) Summary
Object-map contracts and additional-properties helpers
src/datamodel_code_generator/parser/_object_maps.py
The new module defines the ObjectMapsHost protocol and helpers for typed additional-property fields, eligible allOf merging, additional-properties maps, and nullable maps.
Pattern-map and property-name parsing
src/datamodel_code_generator/parser/_object_maps.py
The module adds pattern-map construction, property-name key parsing, property-name maps, and object-map nullability checks.
Parser delegation and helper references
src/datamodel_code_generator/parser/jsonschema.py, src/datamodel_code_generator/parser/_null_facts.py, docs/architecture.md, scripts/decision_homes.toml
JsonSchemaParser delegates object-map operations to the new module. Documentation and decision-home entries identify the extracted helpers.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Merge Risk: Minimal · previous review 122d7

No actionable merge-blocking issue is established for this extraction; merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: moving JSON Schema parser object-map reading into a separate module.
Docstring Coverage Passed 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. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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 18 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T05:32:52.832216Z 122d7d1 PR opened
ℹ️ About Codex in GitHub

Your 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.

@github-actions

Copy link
Copy Markdown
Contributor

@codspeed

codspeed Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

✅ 52 untouched benchmarks
⏩ 98 skipped benchmarks1


Comparing impl-map5 (9c4e6e2) with impl-map3 (d0fc8cf)

Open in CodSpeed

Footnotes

  1. 98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@koxudaxi
Koudai Aono (koxudaxi) merged commit 1b9b3da into main Oct 30, 2026
29 checks passed
@koxudaxi
Koudai Aono (koxudaxi) deleted the impl-map5 branch October 30, 2026 08:10
@github-actions

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: This PR is a pure internal refactor that moves the object map helpers of the JSON Schema parser into a new module parser/_object_maps.py with logic unchanged line for line; only private underscore-prefixed parser methods and private module-level helpers are removed from parser/jsonschema.py, while the public hooks parse_pattern_properties and parse_property_names stay on JsonSchemaParser as delegators, _legacy_object_maps stays cached on the parser, _typed_nullable_map_value_schema and _other_keys_schema remain as delegators, and literal_pattern_value stays exported from parser.jsonschema; the remaining changes are documentation and decision_homes.toml path updates, with no CLI option, default, template, Python version or error handling changes; the accepted behaviour diff cells all concern an allOf whose parts admit no object becoming a root model, logic this diff does not touch, so they reflect other changes merged since the last release rather than this PR, and the crash-fix and both-fail cells do not change default output.


This analysis was produced by the release draft workflow

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🎉 Released in 0.88.0

This PR is now available in the latest release. See the release notes for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant