Skip to content

Read the member a JSON Pointer token names in one place, with the grammar each reader keeps - #5598

Merged
Koudai Aono (koxudaxi) merged 1 commit into
impl-fieldsfrom
impl-members
Oct 29, 2026
Merged

Koudai Aono (koxudaxi) merged 1 commit into
impl-fieldsfrom
impl-members

Conversation

@koxudaxi

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

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Improved JSON Pointer lookups across schema and document processing, including handling of numeric tokens when navigating lists and mappings.
    • Preserved existing lookup behavior across different contexts, including cases where numeric tokens are interpreted differently.
    • Fixed cases where local references could fail to resolve the intended mapping member.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Walkthrough

The change centralizes JSON Pointer member lookup in _document_reader and adds four lookup rows. Existing pointer consumers now select the row for their lookup behavior. The architecture documentation and decision registry record the new rules.

Changes: JSON Pointer Member Lookup

Layer / File(s) Summary
Member lookup rules
src/datamodel_code_generator/_document_reader.py, scripts/decision_homes.toml, docs/architecture.md
member and descend provide four row-specific lookup modes. The decision registry and architecture table record the modes and legacy rows.
Consumer migrations
src/datamodel_code_generator/_fastapi/source_document.py, src/datamodel_code_generator/_openapi_generation.py, src/datamodel_code_generator/_recommend/_signals.py, src/datamodel_code_generator/_target_binding.py
Pointer consumers use descend with the lookup row for their existing behavior. The local traversal helpers are removed.

Priority: Normal

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

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to ef461

No actionable merge blocker is identified in the JSON Pointer lookup consolidation. 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 describes the main change: centralizing JSON Pointer member lookup while preserving reader-specific grammar.
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 4 functions across 5 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.

❤️ 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-29T21:32:25.735128Z ef4614d 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 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-members (ef4614d) with impl-fields (71bf50e)

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 4ff0350 into main Oct 29, 2026
164 checks passed
@koxudaxi
Koudai Aono (koxudaxi) deleted the impl-members branch October 29, 2026 23:51
@github-actions

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: The diff is an internal refactor that merges several private JSON Pointer member readers (the target binding source member helper, the served document step and member helpers, the OpenAPI generation member helper and the recommender local ref walk) into one member function in the private document reader module. A named row picks each reader's grammar, and each row reproduces the logic and caught error set of the code it replaces, so the old behaviour is kept. The descend helper signature changes but only inside private modules, and no CLI option, public Python API, template, Python version or error reporting contract changes. The served document node method now returns None instead of raising for a missing token, but it is only called on pointers already confirmed to exist. The accepted behaviour diff cells concern allOf schemas whose parts admit no object now generating root models or aliases. The gate compares against the last release, so its cells include earlier changes, and their notes tie them to an earlier allOf change that this diff does not touch. The remaining cells are both-fail or crash-fix and 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