Skip to content

JSON::Validator 3 changes#45

Merged
preaction merged 5 commits intopreaction:masterfrom
mohawk2:fix-jv3
Jan 8, 2019
Merged

JSON::Validator 3 changes#45
preaction merged 5 commits intopreaction:masterfrom
mohawk2:fix-jv3

Conversation

@mohawk2
Copy link
Contributor

@mohawk2 mohawk2 commented Jan 7, 2019

JSON::Validator::OpenAPI is gone, use JSON::Validator::OpenAPI::Mojolicious

format functions must return undef when ok

Coerce to real JSON booleans, not 'true'/'false' as JV fixed a bug. Previously coercion did not coerce ie mutate the passed-in values, now it does and it doesn't recognise the strings as boolean values.

Also update the deps, and eliminate a surprising duplicate blog spec in t/helpers.t.

Fixes #44.

JSON::Validator::OpenAPI is gone, use JSON::Validator::OpenAPI::Mojolicious

format functions must return undef when ok

Coerce to real JSON booleans, not 'true'/'false' as JV fixed a
bug. Previously coercion did not work right, now it does and it doesn't
recognise the strings as boolean values.
@coveralls
Copy link

coveralls commented Jan 7, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 8916f8b on mohawk2:fix-jv3 into 4cb8768 on preaction:master.

mohawk2 and others added 2 commits January 7, 2019 05:59
This is weird. I don't know why these particular values need to be
boolean objects instead of 0/1. I would have expected all of the values
to be boolean objects now that output is being coerced, but that's not
what is happening here...
@preaction
Copy link
Owner

I added a commit that removes the need for Cpanel::JSON::XS by changing the test's data, but I have no clue why my commit works. I would've expected that if I were to have changed all the 0 and 1 being used to compare as booleans to the true and false provided by Mojo::JSON, that would've worked. But that didn't work. Instead, I had to change some specific values to true and false (and sometimes change them back. It seems like JSON::Validator is only coercing some of the booleans...

I think we may need to clean up our handling of booleans internally to try to normalize to true and false at the edges (controllers and backends). I don't think that's causing this problem, but it will still be helpful.

Does this additional commit make any sense to you? Because it doesn't to me. All I know is it passes the test and for that I'm okay with releasing it if you are.

@preaction
Copy link
Owner

Also, we may need to add a specific Travis build with PERL5OPT=-MDevel::Hide=Cpanel::JSON::XS just to make sure that everything also works correctly with JSON::PP.

@mohawk2
Copy link
Contributor Author

mohawk2 commented Jan 8, 2019

The extra commit makes sense to me, and is similar to what I tried. Yes, agreed with the Devel::Hide thing. Are you happy to do that or should I?

@preaction
Copy link
Owner

No, I'm wrong: We would need a test with Cpanel::JSON::XS, since Mojo::JSON prefers it in cases where it exists. The 5.14 test was failing without Cpanel::JSON::XS, which made it fall back to Mojo::JSON and JSON::PP::Boolean booleans... Either way, that's not important for this. Let's ship it!

@preaction preaction merged commit c20689b into preaction:master Jan 8, 2019
@preaction
Copy link
Owner

... and Mojo::JSON always uses JSON::PP::true and JSON::PP::false... Curiouser and curiouser...

preaction added a commit that referenced this pull request Jan 9, 2019
    [Added]

    - Added some more intelligent inferences about a configured OpenAPI
      spec to hook up the controller. In short: It's now easier to
      provide your own OpenAPI spec to work with the Yancy editor.
      Thanks @mohawk2 for continuing this work! [Github #43]

    [Fixed]

    - Fixed compatibility with JSON::Validator version 3. Thanks
      @mohawk2 for the patch! [Github #45] Thanks @eserte for the report
      [Github #44]
@mohawk2 mohawk2 deleted the fix-jv3 branch January 10, 2019 05:40
@mohawk2
Copy link
Contributor Author

mohawk2 commented Feb 6, 2019

This was caused by jhthorsen/json-validator#145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON::Validator::OpenAPI was removed

3 participants