Skip to content

Name the JSON config fields once and render both registries through one Markdown renderer - #5490

Merged
Koudai Aono (koxudaxi) merged 2 commits into
dry-r02from
dry-r06
Oct 29, 2026
Merged

Koudai Aono (koxudaxi) merged 2 commits into
dry-r02from
dry-r06

Conversation

@koxudaxi

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

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • The validators setting now follows the same JSON configuration loading and error-reporting path as other JSON-backed settings.
  • Refactor

    • Configuration fields are now handled consistently across project settings and dependency watching.
    • Deprecation and experimental-feature tables and Markdown pages use shared rendering, keeping their presentation consistent.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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 1c9b43a and 5c372c5.

Files selected for processing: 8
  • src/datamodel_code_generator/_cli_config.py
  • src/datamodel_code_generator/_json_config_fields.py
  • src/datamodel_code_generator/_project_config.py
  • src/datamodel_code_generator/_registry_render.py
  • src/datamodel_code_generator/deprecations.py
  • src/datamodel_code_generator/experimental.py
  • src/datamodel_code_generator/json_config.py
  • src/datamodel_code_generator/watch_dependencies.py

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

Walkthrough

The changes centralize JSON configuration field names and add a shared Markdown renderer for deprecation and experimental-feature registries. Configuration consumers use the shared field definitions, while both registries pass their content and page metadata to the renderer.

Changes: JSON Configuration Fields

Layer / File(s) Summary
Shared JSON field contract and consumers
src/datamodel_code_generator/_json_config_fields.py, src/datamodel_code_generator/_cli_config.py, src/datamodel_code_generator/_project_config.py, src/datamodel_code_generator/json_config.py, src/datamodel_code_generator/watch_dependencies.py
A shared JsonConfigFieldName type and JSON_CONFIG_FIELDS tuple replace local field lists. CLI validation, project configuration, JSON configuration typing, and dependency watching use the shared definitions. The validators field now uses the shared JSON configuration loading path.

Registry Markdown Rendering

Layer / File(s) Summary
Shared registry Markdown rendering
src/datamodel_code_generator/_registry_render.py, src/datamodel_code_generator/deprecations.py, src/datamodel_code_generator/experimental.py
A shared renderer builds Markdown tables and entry details. The deprecation and experimental-feature registries supply their columns, cells, details, and page metadata to the renderer.

Priority: Low

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

Merge Risk: Minimal · up to 5c372

No concrete merge-blocking issue is established for the shared configuration fields or Markdown renderer. Mergeability remains subject to normal checks.

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 both primary changes: centralizing JSON config field names and sharing one Markdown renderer for the registries.
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 7 functions across 8 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.

❤️ Share

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-29T06:18:06.289708Z 5c372c5 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 29, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

2 warnings

⚠️ 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

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

⚡ 5 improved benchmarks
❌ 1 regressed benchmark
✅ 46 untouched benchmarks
⏩ 98 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_perf_simple_msgspec_unset_field_rendering 291.5 ms 348.9 ms -16.44%
⚡ test_perf_pattern_properties_adapter_reuse 3.1 ms 2.5 ms +21.08%
⚡ test_perf_empty_pydantic_v2_field_render_plans 27.8 ms 24 ms +15.85%
⚡ test_perf_pydantic_field_name_resolution 1.5 ms 1.3 ms +12.97%
⚡ test_perf_load_yaml_openapi_large 28.9 ms 25.7 ms +12.28%
⚡ test_perf_unique_items_runtime_scalar_validation 2.5 ms 2.3 ms +10.63%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing dry-r06 (5c372c5) with dry-r02 (1c9b43a)

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 29, 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 18e50cf into main Oct 29, 2026
163 of 164 checks passed
@koxudaxi
Koudai Aono (koxudaxi) deleted the dry-r06 branch October 29, 2026 07:10
@github-actions

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: This PR is an internal refactor with no user-facing breaking changes. The list of JSON config field names now lives in one new pydantic-free module, _json_config_fields. The CLI Config validator, the pyproject field sets and the watch_dependencies field set now all build from that list instead of keeping their own copies, and the names in it are the same as before. The separate validators field validator is merged into the generic JSON config validator, which calls the same loader and turns JsonConfigError into Error the same way. JsonConfigFieldName is still available from json_config as an alias. _PYPROJECT_MODEL_JSON_CONFIG_FIELDS is now worked out as all fields minus the target fields, and the 21-name list minus the 9 target fields gives the same 12 model fields as before. The Markdown rendering of deprecations and experimental features moves into a shared helper and produces the same header, table separators, backtick-wrapped ID and Target cells, detail bullets with the optional Replacement and Tracking lines, messages and notes. No CLI options, Python API, templates, defaults or supported Python versions change. The behaviour diff marks some cells as accepted, but they are about allOf parts that admit no object, and their notes point to a separate change. This diff does not touch any parser or code generation logic, so those cells do not come from this PR.


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