jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
53 stars 41 forks source link

Form data single values not promoted to array. #228

Closed mschout closed 2 years ago

mschout commented 2 years ago

I have a similar issue to #220 where we have an API that worked with OpenAPI 2.0, but now that we updated to 3.0, form data array values are not properly promoted to array.

example requestbody:

      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              properties:
                id:
                  type: array
                  items:
                    type: integer

and making a request against this with e.g. id => 123, it returns 400 Bad Request with reason

{
  "errors": [
    {
      "message": "Expected array - got string.",
      "path": "/body/id"
    }
  ],
  "status": 400
}

I have the latest JSON::Validator (5.04) if that helps.

jhthorsen commented 2 years ago

Thanks for reporting in!

This is fixed in https://github.com/jhthorsen/json-validator/commit/65b31df8a319785adb9ab5fbe4462c22e273f8ba aka JSON::Validator 5.05