Jaguar-dart/client

Generate Swagger spec

Opened this issue · 3 comments

Generate swagger specification from Retrofit.

Generally there two mode with Swagger :) either it's generated from the backend side on the fly depending on server implementation (introspection) or the swagger first approach (I consider it the best ^^) where people write manually the Swagger specification and from it generate models (for backend/frontend/mobile) but can also generate directly the retrofit implementation.

Would be nice to be able to work with those two mode :)
But I don't think it should belong to retrofit, should mainly belong the jaguar server

My two cents ^^

Retrofit specification is basically swagger spec. It is much harder on Jaguar server side unless we go swagger first.

Problem is that your swagger definition might not be exhaustive then, because it just depends on what you implement frontend side and not what's implemented server side. And it force you to build the front part to provide backend documentation which look weird to me.

What I've done with nodeJS is Swagger first approach, generate models from swagger definition, then when the server start, it:

  • load the swagger definition
  • generate and map routes from it
  • setup the validation (param, header, body) from it
  • setup auth from it
  • server swagger ui and definition

And my plan was to add:

  • validation/verification of the response
  • generation of integration test automatically to test routes and validations

To put in place swagger first support it's a big work, but once it's done you gain a lot because basically all the stuff is done just by writing your swagger file, then you just need to implement your business logic and your backend side is ready. It's very powerful