You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Write the array an itemSchema stands for, parse the schema of a media type, read the reference a discriminator mapping value names and build the schema of a reference beside its siblings in one place each - #5966
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Walkthrough
The changes update reference-sibling merging, discriminator mapping normalization, and OpenAPI 3.2 parsing for itemSchema and media schemas.
intersect_ref_siblings_schema combines holder array constraints with contains-derived item bounds and retains a supplied target reference. merge_ref_with_schema delegates intersection and metadata handling to it.
discriminator_mapping_ref leaves values containing / or # unchanged and prefixes other values with #/components/schemas/. The FastAPI and OpenAPI readers use the helper to normalize mapping values.
OpenAPI media schema parsing src/datamodel_code_generator/parser/openapi.py, docs/architecture.md
A shared helper constructs the array representation for itemSchema. _parse_media_schema is used for request-body and response media schemas, which are added only when parsing returns a data type. The architecture decision table documents these paths and discriminator mapping interpretation.
No merge-blocking issue is identified in these parsing consolidations. The change is mergeable subject to normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title accurately identifies all four main changes: OpenAPI itemSchema arrays, media-type schema parsing, discriminator mapping references, and reference-sibling handling. It is longer than preferr…
Docstring Coverage
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title accurately identifies all four main changes: OpenAPI itemSchema arrays, media-type schema parsing, discriminator mapping references, and reference-sibling handling. It is longer than preferred but remains specific and clearly related to the changeset.
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 11 functions across 4 files. (1 skipped: 1 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
Warning
Some tools did not complete. Review the errors below.
LanguageTool
docs/architecture.md
LanguageTool checks are incomplete because the per-file request limit of 5 was reached. Remaining text was skipped; findings from completed checks are retained.
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.
Reasoning: The diff is an internal refactor with no user-visible effect. The private OpenAPIParser method _normalize_discriminator_mapping_ref was replaced by a shared helper discriminator_mapping_ref in _document_reader.py with identical logic, and the FastAPI source document now calls the same helper through a new discriminator_target method that keeps the previous branches. The contains-bounds and target-ref handling moved from merge_ref_with_schema into intersect_ref_siblings_schema behind new optional holder and target_ref parameters that default to None, and the steps run in the same order, so existing callers behave the same. In openapi.py the itemSchema array construction and the per-media-type parsing in parse_request_body and parse_responses were extracted into _item_schema_array and _parse_media_schema without changing the paths, locations or skip-on-missing-schema behavior. The docs changes only add or update rows of the architecture decision table. The behaviour diff accepted cells describe allOf parts that admit no object becoming root models or aliases. This diff does not touch that logic, so those cells come from other changes since the last release. The remaining cells are both-fail or crash-fix. No public CLI option, Python API, template, default value, Python version support or error handling was changed.
This analysis was produced by the release draft workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
containsbounds and unsatisfiableenumorconstresults.itemSchemaarrays.