Skip to content

Test schema positions by node instead of parse-path suffixes - #5171

Merged
Koudai Aono (koxudaxi) merged 1 commit into
fix-4858-presetfrom
fe7b-node-tests
Oct 23, 2026
Merged

Koudai Aono (koxudaxi) merged 1 commit into
fix-4858-presetfrom
fe7b-node-tests

Conversation

@koxudaxi

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

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Updated how union branch metadata and root schemas are identified. No user-facing changes are described.

@coderabbitai

coderabbitai Bot commented Oct 22, 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 c1a6fa26716ffcc6a5c25f6898601a405572aa6e and 52872d25faccf22d859f832387df1c2b98d513c9.

📒 Files selected for processing: 1
  • 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; 1 remain after this review.

📝 Walkthrough

Union tag-key variant metadata and root self-reference checks now use schema locations instead of parser paths.

Changes: JSON Schema resolution

Layer / File(s) Summary
Union variant metadata lookup
src/datamodel_code_generator/parser/jsonschema.py
Union tag-key variants are stored and looked up by schema location. Field parsing passes the branch schema to the lookup. The path-suffix stripping helper was removed.
Root self-reference detection
src/datamodel_code_generator/parser/jsonschema.py
Current-root and root self-reference checks compare schema locations rather than resolving parser paths.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 52872

No concrete compatibility or runtime defect is established in the changed schema-resolution paths.

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 names the change: schema positions are now tested by node instead of by parse-path suffixes. The raw summary shows union tag-key variant metadata now keyed by SchemaLocation rather than norm…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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: Title check

Explanation

The title names the change: schema positions are now tested by node instead of by parse-path suffixes. The raw summary shows union tag-key variant metadata now keyed by SchemaLocation rather than normalized parser path, and the path-suffix stripping helper and path-keyed cache were removed. The title is specific and matches the main change in the changeset. It is 60 characters and 9 words, which is concise. The title is slightly developer-facing and refers to testing, while the summary describes a change in the implementation logic, but it still reflects the primary change.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 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

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-22T23:36:02.323247Z 52872d2 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.

@codspeed

codspeed Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 12.1%

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

⚡ 1 improved benchmark
✅ 49 untouched benchmarks
⏩ 98 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_perf_large_models_typed_dict[legacy-requiredness] 736.6 ms 657.1 ms +12.1%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fe7b-node-tests (77ccefe) with fix-4858-preset (c1a6fa2)2

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

  2. No successful run was found on fix-4858-preset (5a44e31) during the generation of this report, so 1db7171 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Oct 23, 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 a2a7b81 into main Oct 23, 2026
25 checks passed
@koxudaxi
Koudai Aono (koxudaxi) deleted the fe7b-node-tests branch October 23, 2026 04:16
@github-actions

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: The PR changes only src/datamodel_code_generator/parser/jsonschema.py and is an internal refactor. The private helper _strip_special_path_suffix is removed. The private attribute _tag_key_variant_paths, which was keyed by joined path strings, is replaced by _tag_key_variants, keyed by the schema object's schema_location. The private method _get_tag_key_variant_key now takes the schema object as well as the path. The private method _is_current_root_schema_path is replaced by _is_current_root_schema, which compares schema locations instead of resolving paths. Every touched symbol is a private parser internal with an underscore prefix. No CLI options, public Python API, templates, default values, supported Python versions or error reporting change. The diff includes no test or expected-output updates, so nothing shows the generated code changing; the change only alters how union-variant tag keys and root self-references are identified internally.


This analysis was produced by the release draft workflow

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