From the course: Planning a Versioned RESTful API with GitHub Copilot

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Extending documentation to accept API versions

Extending documentation to accept API versions - Github Copilot Tutorial

From the course: Planning a Versioned RESTful API with GitHub Copilot

Extending documentation to accept API versions

- [Instructor] Now, so far, the versioning changes that we have implemented, we have used curl calls from our command line to test those changes. But how can we do the same thing using the Swagger documentation? So, let's first start the server. And once the app is running, I'm going to open up the documentation in browser. And hit /docs. Now, as we look into books endpoint, there are many things that we can change, such as the skip and the limit parameter, and/or the status. But there is no way for us to change the versioning information. So, for example, if I hit here, what I'm getting back is always the latest version. But what if I want to try the preview version? So by default, the Swagger documentation that is generated by FastAPI using the function for custom OpenAPI spec doesn't do that job. So in order to do that, we need to implement our own custom OpenAPI spec function. So, I've created this file already, and all it does, it takes the FastAPI app, and it overrides the…

Contents