Is there a way of updating the generated Swagger spec?
See original GitHub issueFirst Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn’t find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google “How to X in FastAPI” and didn’t find any information.
- I already read and followed all the tutorial in the docs and didn’t find an answer.
- I already checked if it is not related to FastAPI but to Pydantic.
- I already checked if it is not related to FastAPI but to Swagger UI.
- I already checked if it is not related to FastAPI but to ReDoc.
Commit to Help
- I commit to help with one of those options 👆
Example Code
app = FastAPI()
app.openapi_version = "3.1.0"
Description
Hi, we have an internal tooling of linting the generated swagger (aka, OpenAPI) doc, which requires the API spec to follow 3.1.0
. However, the current generated version is 3.0.2
.
I used the above code to update it to 3.1.0
, and it works. 😄
However, it looks like I am hard coding the version number, rather than generating with the real v3.1.0
spec, so I wonder is there a way to update the internal swagger spec version?
Thanks 😄
Operating System
Windows
Operating System Details
No response
FastAPI Version
0.65.2
Python Version
3.8.8
Additional Context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Customizing your auto-generated Swagger Definitions in 1.5.x
The extension annotation allows you to add extension properties to a Swagger definition. It is currently supported within the @ApiOperation, @ ...
Read more >API Documentation Made Easy with OpenAPI & Swagger
Swagger Inspector is an easy to use developer tool to quickly execute any API request, validate its responses and generate a corresponding OpenAPI...
Read more >Configuration - Swagger Documentation
The swagger-config.yaml in the project root directory, if it exists, is baked into the application; configuration object passed as an argument to Swagger...
Read more >Swagger Codegen Documentation
Swagger Codegen Documentation. The Swagger Codegen is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined ......
Read more >Improve Your API Documentation Workflow with Compare ...
Or, if you are someone that's following a "code first" approach to Swagger — which means having to use annotations to generate the...
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
Thanks! I’m very glad you have liked it like that! 😁😊 And thanks for coming back to close the issue.
Also thanks @iudeen for the help! 🍰
Hey there! Yep, differences are but too big in the specs. And in fact, FastAPI does a couple of things a tiny bit more compatible with 3.1.0.
The only reason why I haven’t updated it is because Swagger UI breaks. But once they support it I’ll be able to update the generated version.
For now, you should be mostly fine by simply overriding it. I know it feels weird, but it shouldn’t be too problematic if at all.