-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix: FastAPI list parameter parsing in experimental OpenAPI parser #1834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Resolves issue where FastAPI endpoints with list[T] parameters (e.g., `values: list[str]`) generated empty input schemas, causing tools to be unusable. The root cause was that FastAPI generates direct array schemas like: ```json { "type": "array", "items": {"type": "string"}, "title": "Values" } ``` But the schema combination logic only handled: 1. $ref schemas → single "body" property 2. Object schemas with properties → iterate properties Added third case to handle direct array/primitive schemas by using the schema title as the parameter name (e.g., "Values" → "values"), with fallback to generic names. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Jeremiah Lowin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
properties[param_name] = body_schema | ||
if route.request_body.required: | ||
required.append(param_name) | ||
parameter_map[param_name] = {"location": "body", "openapi_name": param_name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Prevent direct array body names from clobbering other parameters
The new branch that generates a parameter name for direct array/primitive request bodies writes the name straight into properties
and parameter_map
without checking for collisions with existing query/path/header parameters. When a route already has a parameter called the same as the array title (e.g. a query parameter values
and a body schema titled Values
), this code replaces the earlier entry so the combined schema loses the query parameter and parameter_map
no longer contains it, meaning the request director cannot send that query parameter at all. The previous collision handling covers only object body properties, so this branch needs similar suffixing or uniqueness logic.
Useful? React with 👍 / 👎.
@silb-saxobank this appears to resolve the example you provided in #1815 |
Tried this change locally and it does indeed seem to solve my issue. 😄 |
Resolves issue #1815 where FastAPI endpoints with list[T] parameters generated empty input schemas, causing tools to be unusable.
The root cause was that the schema combination logic didn't handle direct array schemas generated by FastAPI. Added support for these schemas with comprehensive test coverage.
🤖 Generated with Claude Code