grape-swagger
grape-swagger copied to clipboard
intercept generated swagger doc for modification/extension
Often we will run into a swagger feature that isn't supported by the grape-swagger integration. So my question is, is there a way to intercept the generated swagger json documentation and modify/extend it?
Our specific problems is we have some magic rails(not grape) routes from doorkeeper in addition to standard grape routes that we want to document in swagger. So being able to intercept the generated swagger doc and generate json for these routes would solve the problem.
T
sorry, this isn't possible ATM direct from the gem, but it sounds like a cool feature
@pswenson … can you have a look on the rake task, if it is what you want … feedack and PRs welcome 😉
@LeFnord , also it would be good to have access to initial add_swagger_documentation options. I mean, we put there security definitions which later could be taken into account on scopes injection and fetching.
sorry @texpert for latency … but I think I didn't know exactly what you mean/expect did you expect to call a method to change/manipulate the generated data and also the parameters to do it?
Yep, we have the possibility to specify the Security Definitions (SD) in the add_swagger_documentation hash. They're just in place to define what definitions and scopes are allowed on the API - for example, different authentication grant types could have different scopes.
Further on, Security Objects (SO) could be defined on endpoints and actions. But SO do not contain all the info from SD, especially the grant types are missing.
That's why there is necessary to have instant, but read-only access to these SD - to check the grant types of the incoming requests and thus to be able to differentiate traffic from users, servers, applications, whatever... very useful option regarding security! Moreover, this could serve for integration tests when building the APIs.
I would like to take a stab at this. Is anyone currently working on it?
@thogg4 … it seems, nobody is currently working on, feel welcome :)