[BUG] Swagger `Try it out` missing parameters when using `include_router` with a url variable in the prefix
See original GitHub issueDescribe the bug
When a router is added to an app using include_router
, and the prefix
parameter contains a url variable (e.g. ‘/{account}/devices’), the variable is not included as a parameter in the swagger documentation.
To Reproduce Steps to reproduce the behavior:
- Create a router using APIRouter()
- Add the router to the app using
app.include_router
with a prefix. - Add a url variable to the prefix
app.include_router(
device_router,
prefix="/{account}/devices"
)
- Launch the application and browse to /docs
- Expand the path and click the
Try it out
button
Expected behavior
When browsing the swagger docs on http://localhost:8080/docs, I want to be able to use the Try it out
feature.
Screenshots
Environment:
-
OS: [e.g. Linux / macOS]
-
FastAPI Version: 0.38.1
-
Python version: 3.7
Additional context
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Describing Parameters - Swagger
Query parameters can be primitive values, arrays and objects. OpenAPI 3.0 provides several ways to serialize objects and arrays in the query string....
Read more >Configuration - Swagger Documentation
The swagger-config.yaml in the project root directory, if it exists, is baked into ... Enables overriding configuration parameters via URL search params.
Read more >Parameter Serialization - Swagger
Parameter Serialization · style defines how multiple values are delimited. Possible styles depend on the parameter location – path, query, header or cookie....
Read more >Paths and Operations - Swagger
You can use curly braces {} to mark parts of an URL as path parameters: ... The API client needs to provide appropriate...
Read more >OpenAPI Specification - Version 2.0 - Swagger
The list can use the Reference Object to link to parameters that are defined at the Swagger Object's parameters. There can be one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah this sounds like a bug in the openapi schema generation. Probably worth a check to see if updating to 0.42 fixes it.
Thanks for the help here everyone! 👏 🙇
I assume you solved your problem, so thanks for reporting back and closing the issue 👍