Skip to content

Decide the effective parameters and security of an operation and read a parameter's location in one place each - #5756

Merged
Koudai Aono (koxudaxi) merged 1 commit into
mainfrom
impl-batch-z5
Oct 31, 2026
Merged

Koudai Aono (koxudaxi) merged 1 commit into
mainfrom
impl-batch-z5

Conversation

@koxudaxi

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

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • OpenAPI operations now correctly combine parameters defined at the operation, path, and document levels, applying overrides according to parameter location and name.
    • Header parameter names are compared without regard to case when resolving parameter identity.
    • Operations now inherit document-level security when they do not specify security, while an explicitly empty operation-level security setting remains effective.

@coderabbitai

coderabbitai Bot commented Oct 31, 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 8b894bc and b3e2367.

Files ignored due to path filters: 1
  • docs/llms-full.txt is excluded by none and included by none
Files selected for processing: 12
  • docs/architecture.md
  • scripts/decision_homes.toml
  • src/datamodel_code_generator/_client/plan.py
  • src/datamodel_code_generator/_client/protocol_plan.py
  • src/datamodel_code_generator/_fastapi/plan.py
  • src/datamodel_code_generator/_openapi_paths.py
  • src/datamodel_code_generator/_openapi_wire_plan.py
  • src/datamodel_code_generator/_target_binding.py
  • src/datamodel_code_generator/_target_contract.py
  • src/datamodel_code_generator/_target_operations.py
  • src/datamodel_code_generator/parser/openapi.py
  • src/datamodel_code_generator/parser/openapi_scope.py

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

Parameter location and wire-name lookups now use shared contract helpers. OpenAPI parameter and security inheritance now use shared helpers in parser and scope walks. The architecture documentation and decision-home rules describe these helpers and parameter-override behavior.

Changes: OpenAPI parameter and operation contracts

Layer / File(s) Summary
Parameter place contract and consumers
src/datamodel_code_generator/_target_contract.py, src/datamodel_code_generator/_client/plan.py, src/datamodel_code_generator/_client/protocol_plan.py, src/datamodel_code_generator/_fastapi/plan.py, src/datamodel_code_generator/_openapi_wire_plan.py, src/datamodel_code_generator/_target_operations.py, scripts/decision_homes.toml
parameter_location and parameter_place provide parameter location and wire-name information. Client, FastAPI, wire-planning, and target-operation code use these helpers. Decision-home rules record parameter-location ownership and the paths-scope override behavior.
Effective operation parameters and security
src/datamodel_code_generator/_openapi_paths.py, src/datamodel_code_generator/parser/openapi.py, src/datamodel_code_generator/parser/openapi_scope.py, src/datamodel_code_generator/_target_binding.py, docs/architecture.md, scripts/decision_homes.toml
Shared helpers merge operation parameters with inherited parameters and determine inherited security. The parser and scope walk use the helpers to build effective operations, and target binding uses the inherited-security helper. Documentation describes the inheritance rules and paths-scope header-name behavior.

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant OpenAPIParser
  participant effective_parameters
  participant effective_operation
  participant _walk_api_operation
  OpenAPIParser->>effective_parameters: Merge operation and inherited parameters
  OpenAPIParser->>effective_operation: Add effective parameters and inherited security
  _walk_api_operation->>effective_parameters: Merge operation and common parameters
  _walk_api_operation->>effective_operation: Add effective parameters and API-level security
Loading
Merge Risk: Minimal · up to b3e23

The change centralizes existing parameter and security decisions. No actionable merge-blocking risk is established; 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 accurately summarizes the main changes: centralizing effective operation parameter and security resolution, and centralizing parameter-location lookup.
Docstring Coverage Passed Docstring coverage is 80.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. Documentati…
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 80.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 15 functions across 10 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

@koxudaxi
Koudai Aono (koxudaxi) marked this pull request as ready for review October 31, 2026 05:48
@koxudaxi Koudai Aono (koxudaxi) changed the title impl batch z5 Decide the effective parameters and security of an operation and read a parameter's location in one place each Oct 31, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-31T05:49:21.468336Z b3e2367 Draft marked ready
ℹ️ 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 31, 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-batch-z5 (b3e2367) with main (8b894bc)

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

@github-actions

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Oct 31, 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 87ec71b into main Oct 31, 2026
164 checks passed
@koxudaxi
Koudai Aono (koxudaxi) deleted the impl-batch-z5 branch October 31, 2026 06:18
@github-actions

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: This PR is an internal refactor that moves existing logic into shared helpers without changing behaviour. In _openapi_paths.py it adds effective_parameters, inherited_security and effective_operation, and in _target_contract.py it adds parameter_location and parameter_place. The paths-scope walk in parser/openapi.py, the API walk in parser/openapi_scope.py, the target binding, the wire plan, the client and FastAPI planners, and the placeholder checks now call these helpers instead of repeating the code inline. Each replacement keeps the old semantics. Parameter overrides still use the same keys: the paths-scope walk overrides by name as written, and the API walk folds header names through parameter_key. An operation is still copied only when its path item has parameters or it inherits security. Security is inherited only when the raw operation does not declare its own. Location and wire-name lookups still go through the same LOCATIONS mapping and the same name-or-empty fallback. The only removed lines are imports of the private LOCATIONS name in internal modules, inline code that was replaced, and documentation text. No CLI options, public API, templates, defaults, Python version support or error reporting change. The new legacy-case-sensitive-parameter-override row only records existing behaviour. The accepted cells in the behaviour diff are all about allOf parts that admit no object becoming root models, which this diff does not touch, so they come from other changes since the last release.


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