python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.16k stars 335 forks source link

Open API V3 Support #26

Open ndamclean opened 4 years ago

ndamclean commented 4 years ago

flask_restplus currently outputs the swagger.json in the old "Swagger 2.0" format. Are there any plans to also support the OpenAPI 3.x specification?

OpenAPI 3.x has better support for different authentication methods, including JWT token-based authentication.

twsl commented 4 years ago

This includes updating the 2 year old swagger-ui-dist

Cheaterman commented 4 years ago

Any updates on this? :-) I don't mind Swagger 2.0 myself, but I'm getting requests for OpenAPI 3.x. I'd be happy to help if needed!

sherghan commented 4 years ago

Could you at least write something about plans for OpenAPI 3 in the readme.md? Currently it does not even recognize the existence of the new major version of the format.

With no such information one could easily get a false impression that it is implemented, working fine and there is not much to talk about.

...It's not that 3.0 appeared yesterday.

francesco086 commented 4 years ago

I think this is a rather serious issue. This is what refrains me from using this library...

rawouter commented 3 years ago

I'm being requested to move to OpenAPI 3 for a rather big project, do you have any roadmap?

j5awry commented 3 years ago

I want to bring up some big points here --

1) the logic for creating the Swagger docs are ingrained in the RestX classes. So it's a heavy lift with the current architecture to support both 2.0 and 3.0. 2) We've had discussions of moving the modeling from the RestX specific classes to a more generalized framework: https://github.com/python-restx/flask-restx/issues/59

I completely understand the need to move to OpenAPI 3.0, but it's going to be a large lift. We welcome contributions from all over, and I'm working through some more of the backlog of open PRs and issues.

mauvilsa commented 2 years ago

Just out of curiosity. Is there a python library that is able to convert swagger 2.0 to openapi 3.0? If there is such library, would it make sense that flask-restx have the option to use this to switch between 2.0 and 3.0? Maybe just do this as a short term solution until the more generalized framework is done.

I know some time ago I used some converter from swagger 2.0 to openapi 3.0. A few details were not converted correctly so I stopped doing that. But don't know if it is impossible to do this conversion perfectly or was the converter that had some bug or missing features. Anyway, just throwing out an idea in case it could be useful.