Bug
The FastAPI parser has two param extraction issues that cause broken CLI commands:
1. Pydantic model body params are stripped
Endpoints like POST /items/ that accept a Pydantic model body:
def create_item(session: SessionDep, current_user: CurrentUser, item_in: ItemCreate):
The item_in: ItemCreate param is detected as a regular param but its inner fields (title, description) are not expanded. The CLI generates create-item with no --body flag.
Expected: create-item --body '{"title":"...", "description":"..."}' or expanded flags --title --description
2. Body params sent as query when they should be body
test-email sends email_to as a body param but the server expects it as query:
Error: Validation error: {"detail":[{"type":"missing","loc":["query","email_to"]}]}
Affected commands (full-stack-fastapi-template)
create-item — no body flag, can't create items
create-user — same issue
update-user — same
update-item — same
test-email — body/query misclassification
register-user — has --user-in but expects raw JSON string (awkward UX)
Root cause
_extract_params() in fastapi_parser.py doesn't resolve Pydantic model types to their fields, and the body/query classification heuristic doesn't match what FastAPI actually does.
Reproduction
- Parse
https://github.com/fastapi/full-stack-fastapi-template
- Generate CLI
- Try
create-item --body '{"title":"test"}' → "No such option: --body"
Bug
The FastAPI parser has two param extraction issues that cause broken CLI commands:
1. Pydantic model body params are stripped
Endpoints like
POST /items/that accept a Pydantic model body:The
item_in: ItemCreateparam is detected as a regular param but its inner fields (title,description) are not expanded. The CLI generatescreate-itemwith no--bodyflag.Expected:
create-item --body '{"title":"...", "description":"..."}'or expanded flags--title --description2. Body params sent as query when they should be body
test-emailsendsemail_toas a body param but the server expects it as query:Affected commands (full-stack-fastapi-template)
create-item— no body flag, can't create itemscreate-user— same issueupdate-user— sameupdate-item— sametest-email— body/query misclassificationregister-user— has--user-inbut expects raw JSON string (awkward UX)Root cause
_extract_params()infastapi_parser.pydoesn't resolve Pydantic model types to their fields, and the body/query classification heuristic doesn't match what FastAPI actually does.Reproduction
https://github.com/fastapi/full-stack-fastapi-templatecreate-item --body '{"title":"test"}'→ "No such option: --body"