jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
54 stars 44 forks source link

param in=>query, type=>array does not work anymore #245

Closed akarelas closed 1 year ago

akarelas commented 1 year ago

As demonstrated in this repo, $self->every_param returns an arrayref with only the first value of that parameter in it, instead of all query values of that parameter.

every_param breaks in this way when using JSON::Validator 5.09, which is a requirement for Mojolicious::Plugin::OpenAPI 5.04.

appuser$ carton exec -- script/my_app get '/pets?foo=1&foo=2'
[2023-07-04 18:43:03.30051] [344164] [trace] [PBFdKZIhdqox] GET "/pets"
[2023-07-04 18:43:03.30082] [344164] [trace] [PBFdKZIhdqox] Routing to controller "MyApp::Controller::Pets" and action "index"
[2023-07-04 18:43:03.30137] [344164] [trace] [PBFdKZIhdqox] 200 OK (0.000852s, 1173.709/s)
{"foo":["1"]}
akarelas commented 1 year ago

The OpenAPI schema is here: https://gitlab.com/karjala/every-param-demo/-/blob/main/lib/MyApp.pm#L16-46

akarelas commented 1 year ago

Sorry, I just had to use collectionFormat => 'multi' in the array spec. Sorry.