'Can I generate an Open API 3 Python Flask server?
From http://editor.swagger.io/ with swagger 2.0 I am able to select: Generate Server-->python-flask and generate a python server that I can deploy and use.
BUT When I change to use OpenAPI v3 by selecting Edit--> Convert to Open API 3 I now no longer see the option to generate a python flask server.
Is this not implemented or is there another way to do this?
Solution 1:[1]
You may want to try OpenAPI Generator instead.
- Download http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.0-beta3/openapi-generator-cli-4.0.0-beta3.jar
- [Mac/Linux] java -jar openapi-generator-cli-4.0.0-beta3.jar generate -g python-flask-server -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/python-flask
- [Windows] java -jar openapi-generator-cli-4.0.0-beta3.jar generate -g python-flask -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o C:\temp\python-flask\
Solution 2:[2]
Python Flask server generator for OpenAPI 3.0 is now available in Swagger Editor and Swagger Codegen 3.0.9+.
Solution 3:[3]
install Bash Launcher Script from https://openapi-generator.tech/docs/installation
create example.sh file
#!/bin/sh openapi-generator-cli generate \ -g python-flask \ -i <your .yaml directory> \ -o <output directory>
run example.sh
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | William Cheng |
Solution 2 | Helen |
Solution 3 | Suraj Rao |