praekelt/swagger-django-generator

Why not use dango-rest-framework with swagger support for creation?

Opened this issue · 1 comments

Why not use dango-rest-framework with swagger support for creation?

Hi @dkdndes

The main motivation was to have an "API first" approach in the project this tool was borne out of. We could define the API upfront using Swagger, spin up a mock server using the spec and eventually generate the scaffolding for the API from the same spec as well.
From a Django-perspective, the API touched a small subset of the models defined and used a different type of authentication than the rest of the system.

Despite the name of this repo, this tool also supports generating code for aiohttpd, which we required as well.

We used the official Swagger codegen tool to generate the server code for two Flask-based components, as well as the client code used by the Django, aiohttp and Flask components.

DRF with Swagger support is fine for projects where API specification is based on the model definitions, etc. (We have projects like that.) In this particular case I wanted the API code to be a function of the specification, though.

I hope this answers your question sufficiently.