grape-swagger
grape-swagger copied to clipboard
Handle arrays in Grape::Endpoint#expose_params
Since, in ruby-grape/grape#1863, I changed the code that made type
a string, the code that generates the appropriate OpenAPI array definitions in grape-swagger
broke.
In #expose_params
there is a nasty trick (hack?) that removes the brackets from stringified Array classes in order to (recursively) expose the params (introduced here). The change in this PR treats arrays as first class objects.
Unfortunately I can't say I fully understand what's going on, therefore, please guide me and let me know if this is gonna introduce any regressions to existing projects.
This PR works with ruby-grape/grape#1863, thus specs might be broken for HEAD
or other versions.
Coverage decreased (-0.1%) to 99.364% when pulling 917bd8b5e179395f83e1ab5b1118df8cf6881679 on fotos:fix-array-handling into e1261f8627354b1a724186f22cb3881a07c2cda1 on ruby-grape:master.
@fotos … please see my comment here https://github.com/ruby-grape/grape-swagger/issues/741#issuecomment-475039725
and many thanks … 👍
Hey, is there any chance that this may get merged? cc @LeFnord @fotos