theoomoregbee / sails-hook-swagger-generator

A tool to help generate Swagger specification documentation based on OAS 3.0 for Sails APIs
MIT License
78 stars 33 forks source link

Defining Arrays as body or formData params #36

Closed RotemBot closed 5 years ago

RotemBot commented 6 years ago

I couldn't find a way to define array-type params through the custom routes.

When a param in the body is defined as string, it is possible to send it as a string array, but the type in the UI says 'string' - Which clearly defeats the point of having a swagger UI...

Can you please provide a tested, working example of a custom route which requires an array as a body param?

theoomoregbee commented 6 years ago

Don't seem to understand this line

When a param in the body is defined as string, it is possible to send it as a string array, but the type in the UI says 'string'

So currently there's no way to specify array without specifying an item will look into this. Also, I think it was mentioned before in one of the issues #29

Oh you asked over in #29 of an example with an array as a field type in swagger UI, I think you can head over to swagger UI to discover that if that's the problem

RotemBot commented 6 years ago

No, I don't need an example of how to do it in the Swagger file, I needed an example of how to do it through custom routes - but you said it is not possible, so... Problem. Thanks, anyway. Hopefully you could make it possible soon enough :)

What I meant by that line you didn't understand, was that even though there is no way to specify a paramter as an array, it is still possible to send an array through it using the Swagger UI, given that it is a part of 'body'.

theoomoregbee commented 6 years ago

oh ok, will go through this soon

sudograce commented 5 years ago

@theo4u I have the same problem. Please tell me if a solution is planned for this problem? Thanks! :)

theoomoregbee commented 5 years ago

yeah

theoomoregbee commented 5 years ago

@sudograce @RotemBot just to be clear I'm going to make items available for array field types, which should solve the problem of swagger UI not handling array type fields

theoomoregbee commented 5 years ago

example usage here: https://github.com/theo4u/sails-hook-swagger-generator/blob/1e862bf9093da3313db7ddba8890f492760bbcee/config/routes.js#L81-L93