Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode ref schema doesn't allow_nonref #14

Closed
Relequestual opened this issue Apr 28, 2017 · 0 comments
Closed

Decode ref schema doesn't allow_nonref #14

Relequestual opened this issue Apr 28, 2017 · 0 comments

Comments

@Relequestual
Copy link
Contributor

With draft-6, ref schema may be boolean, which means allow_nonref must be 1 to allow scalar json encode and decode.
Pull request incoming.

On our dev systems, I am currently unable to install JSON Schema AsType, as one test fails.

# {
        #   'properties' => {
        #     '$ref' => {
        #       'type' => 'string'
        #     }
        #   }
        # }
        # Reference {"\$ref" => 2} did not pass type constraint "Properties[$ref,String]"
        # "Properties[$ref,String]" is defined as: sub { package JSON::Schema::AsType::Draft4::Types; return 1 unless Object->check($_); return $type->check($_); }
        # {
        #   '$ref' => '#/definitions/bool',
        #   'definitions' => {
        #     'bool' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' )
        #   }
        # }
        # {
        #   '$ref' => '#/definitions/bool',
        #   'definitions' => {
        #     'bool' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' )
        #   }
        # }
        # Child ($ref to boolean schema false) exited without calling finalize()
    
    #   Failed test '$ref to boolean schema false'
    #   at /usr/local/share/perl/5.18.2/Test/Builder.pm line 266.
hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /.../perl5/lib/perl5/JSON.pm line 154.
    # Child (t/json-schema-test-suite/tests/draft6/ref.json) exited without calling finalize()

#   Failed test 't/json-schema-test-suite/tests/draft6/ref.json'

It's strange that this problem isn't picked up by TravisCI running tests. I'm not sure why this is the case.

The only think I thought MIGHT be an issue is the notice at https://metacpan.org/changes/release/MAKAMAKA/JSON-2.90 for JSON 2.9, as I do have JSON::XS installed, but I still can't make the link.
My module versions are as follows:

# Versions for all modules listed in MYMETA.json (including optional ones):
# 
# === Configure Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.22
# 
# === Build Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.22
# 
# === Test Requires ===
# 
#     Module               Want     Have
#     ------------------- ----- --------
#     Exporter              any     5.68
#     ExtUtils::MakeMaker   any     7.22
#     File::Spec            any     3.40
#     IO::Handle            any     1.34
#     IPC::Open3            any     1.13
#     Path::Tiny          0.062    0.104
#     Test::Deep            any    0.114
#     Test::Exception       any     0.32
#     Test::More            any 1.001014
#     lib                   any     0.63
#     parent                any    0.225
# 
# === Test Recommends ===
# 
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.150005
# 
# === Runtime Requires ===
# 
#     Module                  Want     Have
#     ---------------------- ----- --------
#     Class::Load              any     0.20
#     Clone                    any     0.36
#     JSON                     any     2.90
#     LWP::Simple              any     6.13
#     List::AllUtils           any     0.14
#     List::MoreUtils          any     0.33
#     List::Util               any     1.47
#     Moose                    any   2.1005
#     Moose::Role              any   2.1005
#     Moose::Util              any   2.1005
#     MooseX::ClassAttribute   any     0.29
#     MooseX::MungeHas         any    0.007
#     Path::Tiny             0.062    0.104
#     Scalar::Util             any     1.47
#     Type::Library            any 1.000005
#     Type::Tiny               any 1.000005
#     Type::Tiny::Class        any 1.000005
#     Type::Utils              any 1.000005
#     Types::Standard          any 1.000005
#     URI                      any     1.60
#     strict                   any     1.07
#     warnings                 any     1.18

yanick added a commit that referenced this issue May 2, 2017
 - add 'allow-nonref' for JSON serializing (GH#14, Ben Hutton)

Fixes #14
@yanick yanick closed this as completed in 779a9a8 May 2, 2017
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

No branches or pull requests

1 participant