Skip to content

lyft/swagger-py-codegen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask RESTful Application Code Generator

Build Status

Overview

Generate Flask-RESTful application code from a Swagger Specification doc.

Alpha version for now, it can not handle all validation properly.

Install

pip install swagger-py-codegen

Usage

Create all:

swagger_py_codegen --swagger-doc api.yml example-app

Command Options:

-s, --swagger, --swagger-doc        Swagger doc file.  [required]
-f, --force                         Force overwrite.
-p, --package                       Package name / application name.
-t, --template-dir                  Path of your custom templates directory.
--spec, --specification             Generate online specification json response.
--ui                                Generate swagger ui.
--help                              Show this message and exit.

Examples:

Generate example-app from apis.yml:

$tree
.
|__ api.yml

$ swagger_py_codegen -s  api.yml  example-app -p demo
$ tree
.
|__ api.yml
|__ example-app
   |__ demo
   |  |__ __init__.py
   |  |__ v1
   |     |__ api
   |     |  |__ __init__.py
   |     |  |__ oauth_auth_approach_approach.py
   |     |  |__ oauth_auth_approach.py
   |     |  |__ users_token.py
   |     |  |__ users_current.py
   |     |  |__ users.py
   |     |__ __init__.py
   |     |__ routes.py
   |     |__ schemas.py
   |     |__ validators.py
   |__ requirements.txt

Install example-app requirements:

$ cd example-app
$ pip install -r requirements.txt

Start example-app:

$ cd demo
$ python __init__.py

And generate example-app-ui from apis.yml with ui:

$ swagger_py_codegen -s  api.yml  example-app-ui -p demo-ui --ui

Authors


See the AUTHORS.

License


MIT

About

Flask RESTful Application Code Generator

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.5%
  • CSS 5.0%
  • Python 2.9%
  • Other 0.6%