jhthorsen / mojolicious-plugin-openapi

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

Can not disable coerce for all #72

Closed KES777 closed 6 years ago

KES777 commented 6 years ago

Odd number of elements in anonymous hash at /home/kes/work/projects/tucha/monkeyman/app/tucha/../..//local/lib/perl5/JSON/Validator.pm line 119

$app->plugin(OpenAPI => {
    coerce => 0,
});
jhthorsen commented 6 years ago

Where is it documented that you can pass on 0 ? Try with an empty hash instead.

Out of curiosity: Why do you want to disable coercion?

KES777 commented 6 years ago

Because of this:

WARNING! Enabling coercion might hide bugs in your api, which would have been detected if you were strict.

Where is it documented that you can pass on 0 ?

I suppose if there is the operation there should be reverse operation, is not?

jhthorsen commented 6 years ago

Oh, right. I just removed the warning in https://github.com/jhthorsen/json-validator/commit/f7bf50a02946db00aa52337e58b618ed6b033433 and documentation for coerce(1) in https://github.com/jhthorsen/json-validator/commit/41ad1a64d10340047ed7c6815eaa32e7c839fc63

Thanks!

KES777 commented 6 years ago

mm. Is it hide bugs or not? If "yes", I will prefer to see warning

jhthorsen commented 6 years ago

I have not experienced any issues. That's why I feel it's safe to remove the warning now.