fotinakis / swagger-blocks

Define and serve live-updating Swagger JSON for Ruby apps.
MIT License
622 stars 98 forks source link

Generating Swagger-Blocks based on JSON response? #92

Closed ezuk closed 7 years ago

ezuk commented 7 years ago

Hi there,

Can I somehow feed Swagger Blocks (or an associated tool) with a JSON dump of my server's response, and have it magically generate the Ruby for me?

i.e, document backwards -- docs last, based on the response I already have.

jodigiordano commented 7 years ago

First of all, awesome work on ErgoDox EZ ;)

I am not affiliated with this project (I only use it) but I understand what you want to achieve. To support this, you need to code the part that translate your JSON dump to Swagger::Blocks definitions. It would be some kind of API documentation generator by examples where you feed JSON examples (route, method, authentication, request, response) and the documentation is produced. This approach has a lot of challenges and drawbacks, way out of scope of this project IMO.

I used this project for a new API so for me, what would be useful is a DSL on top of Swagger::Blocks and other libs so I only have to define once my API and then:

That would save me a lot of boilerplate code. If you're in the same situation, you could try Grape and Grape-Swagger.

Cheers!

fotinakis commented 7 years ago

I like the ideas here but this issue is definitely out of scope of this project and my limited time in maintaining it. Going to close this as wontfix to keep things clean, but please feel free to comment if any fruitful discussions come up.

ezuk commented 7 years ago

Thank you @jodigiordano! Will explore in that direction next time I need Swagger. And thanks for your kind words re the ErgoDox EZ! :) And thanks @fotinakis as well, totally agree with wontfix.