Closed jusdude closed 4 years ago
I'm quite busy these days, so I would love to see a PR for this. I think I would start by adding a new test to https://github.com/jhthorsen/mojolicious-plugin-openapi/blob/master/t/v3.t which also cares about boolean, and not just integer and strings.
Closed by #147.
When setting a parameter type as boolean with v3, I discovered that the value returned by
validation->output()
is not a JSON::PP::Boolean but a scalar. While debugging, I found out that the value was not going through the coerse function, and this was coming from the field type not being taken into account.The type seems not to be retrieved correctly in lib/JSON/Validator/OpenAPI/Mojolicious.pm, line 69 :
my ($in, $name, $type) = @$p{qw(in name type)};
This works with v2, but with v3 the type should be within the schema property (
$p->{schema}{type}
) or even within the content property (according to the specs).This is the YAML I used for my tests