Closed plk closed 4 years ago
It haven’t stopped working, it simply haven’t been implemented for v3.
You can see https://github.com/mojolicious/json-validator/issues/55 for a full discussion, and I still don’t know how to do it.
Is there anything that I might do to help this along? I believe it stopped at your new JSON::Validator
version which didn't fix the defaults thing for me and which currently gives a deprecation warning?
Should this work now with the latest versions? Doesn't seem to for me with the test file above. Is there a consensus on what needs to be done? This is still a blocker for me for several migrations to v3.
I think that a modification around the current line 92 of JSON::Validator::OpenAPI::Mojolicious should do the job :
($exists, $value) = (1, $p->{default}) if !$exists and exists $p->{default};
For v3, the key "default" is placed at an extra level : $p->{schema}
I can create a pull request but I'm not sure if it solves all the cases or if it is the right place to do it ?
I think I've misunderstood this issue: I thought this was the general "default" wherever inside the schema, but just supporting defaults for the top level is broken in 3.x indeed, and used to work.
Thanks for the PR @SebMourlhou. I'm going to close this issue, since #151 is close to being merged.
Direct copy of #53 converted to openapi3 spec but defaults seems to have stopped working? Using 2.12 and JSON::Validator 3.06. Last time this was a JSON::Validator problem I believe ...