Use Open API data model
Last updated
Was this helpful?
Last updated
Was this helpful?
To be simple comparison, I migrated project to .
What's in the bookstore_openapi project?
Install : pip install -U drf-yasg
The lastest djangorestframework
is 3.12, which is not compatible with drf-yasg
.
Make sure you have pip install djangorestframework==3.11.1
Also check drf-yasg document for how to set up settings.py
and urls.py
Then copy the whole book models, serializers, api.
Start server. In browser, open http://127.0.0.1:8000/swagger.yaml
.
: this is openapi code generator home page,
you may got lost in here.
, to download the latest one. Or in windows, open PowerShell to download it :
Invoke-WebRequest -OutFile swagger-codegen-cli.jar https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.15/swagger-codegen-cli-2.4.15.jar
To use cli
Generate Flask code
Generate nodejs code : use the swagger-codegen-cli.jar.
Generate go code
Actually, [django REST framework support] OpenAPI(); however, the way to download yaml file is odd. Need further investigate.