grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

Handle arrays in Grape::Endpoint#expose_params

Open fotos opened this issue 6 years ago • 3 comments

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.

fotos avatar Feb 16 '19 15:02 fotos

Coverage Status

Coverage decreased (-0.1%) to 99.364% when pulling 917bd8b5e179395f83e1ab5b1118df8cf6881679 on fotos:fix-array-handling into e1261f8627354b1a724186f22cb3881a07c2cda1 on ruby-grape:master.

coveralls avatar Feb 16 '19 15:02 coveralls

@fotos … please see my comment here https://github.com/ruby-grape/grape-swagger/issues/741#issuecomment-475039725

and many thanks … 👍

LeFnord avatar Mar 20 '19 21:03 LeFnord

Hey, is there any chance that this may get merged? cc @LeFnord @fotos

swistaczek avatar May 14 '20 12:05 swistaczek