jhthorsen / mojolicious-plugin-openapi

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

Support for v3 array parameters #154

Closed SebMourlhou closed 4 years ago

SebMourlhou commented 4 years ago

Here is a proposal for issue #149

SebMourlhou commented 4 years ago

See https://swagger.io/docs/specification/serialization/

$custom_re is useful for the styles "label" and "matrix". The regex is just a dot for "label" but with "matrix", it is more complicated (depends on the name of the parameter). $data must begin with this regex (explode true or false). If explode is true, the delimitor is this regex, that's why $collection_format becomes "custom". If explode is false, $collection_format is simply "csv".

$custom_re is then used if $collection_format is "custom" : https://github.com/SebMourlhou/mojolicious-plugin-openapi/blob/3993d2ce8094650e8113523ca75f6c048bd22896/lib/JSON/Validator/OpenAPI/Mojolicious.pm#L234-L235