No way to add description to path parameters
See original GitHub issueI can’t see any way to add a description to a path parameter. Using the @blp.doc
decorator as in:
@blp.doc(parameters=[{"name": "thing_id", "description": "The ID of the thing"}])
just results in adding another parameter with a duplicate name and only a description. I have a local fix for this in FlaskPlugin
where I just scan the existing parameters and update rather than append if I find one with the same name. I can get this into a PR unless you have another way you’d rather approach this?
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Describing Parameters - Swagger
In OpenAPI 3.0, parameters are defined in the parameters section of an operation or path. To describe a parameter, you specify its name...
Read more >FastAPI - Add description for path parameter in swagger
You can add description for a specific parameter by using the description argument to the parameter type object: item_id: int = Path(...
Read more >Path Parameters - FastAPI
You can declare path "parameters" or "variables" with the same syntax used by Python format strings: from fastapi import FastAPI app = FastAPI() ......
Read more >How to add path parameters to API definition in ... - YouTube
With this video we will learn following in Open API specification 3.0 (OAS):1. How to add path parameters to API definition2. How to...
Read more >Step 3: Parameters (API reference tutorial) | Documenting APIs
The endpoint also sets off the path parameter ( comment_id ) in a recognizable way in ... There's no right way to document...
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
Well, for what it’s worth, here https://github.com/congenica-andrew/flask-rest-api/commit/fe427b1529f04b547937625fa27c163c8d1819e4 is what I have already.
Good.
I think my rationale here was that:
@blp.doc
is a last resort, so it will always be rough along the edges. It provides access to the internals. Let’s not try to do too much checks in there, but rather, let’s provide nice interfaces so that developers don’t need it in the first place.Ultimately, I’d rather have a nicer way of passing path params doc. I would have liked to avoid yet another decorator, but I’m afraid this is the least awkward solution identified for now.