Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Create Swagger/OpenAPI page
#1
Hi everyone, I come from a .NET Core background and have created APIs and microservices. We used swagger to help document our apis and to give specifications on what the request object should look like and what the response should look like and so forth.

I am not getting into python for my new job and they have a huge api and I wanted to add Swagger/OpenAPI. The issue I am seeing is that it looks like I have to manually create the specification for each route/endpoint and create the schema/model and the request and responses in the swagger.json file.

In .NET Core, I was able to use some dependency injection and create an entire swagger page with all the endpoints being shown and defined without me needing to do much else. If I created or removed an endpoint, it would reflect automatically.

Is there a way for me to do that in python as well?
Reply
#2
FastAPI has OpenAPI(previously known as Swagger) build in as a feature.
FastAPI is the new star Python framework and use many modern features.

Django and Flask is now matured framework,can use OpenAPI in both.
There are serval extension for this eg for Flask can use Flask-RESTPlus,
that has that has Swagger/OpenAPI build as a feature,example Working with APIs using Flask, Flask-RESTPlus and Swagger UI.
Reply
#3
I think that is what I was looking for.

We are currently using flask. Would we need to rewire everything to use RESTPlus in this case?
Reply
#4
(Nov-10-2021, 03:58 PM)tlopezdh Wrote: We are currently using flask. Would we need to rewire everything to use RESTPlus in this case?
It good option as Flask-RESTPlus has build in feature to generated automatically Swagger/OpenAPI documentation.
How to create a swagger documentation with Flask?
tlopezdh likes this post
Reply
#5
Gotcha, thank you for pointing me in the right direction! It'll be a ton of rewriting I think but worth it to do.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,618 Mar-19-2020, 06:13 PM
Last Post: apollo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020