jef-sure / d2-oar

0 stars 5 forks source link

Data::Walk crash #3

Open racke opened 6 years ago

racke commented 6 years ago

Do you have any idea how to fix the following problem (using the schema file from https://github.com/sympa-community/sympa-spec-openapi/blob/master/swagger/sympa-api.json) ?

racke@belukha:~/sympa-community/sympa-rest-api$ plackup bin/app.psgi 
Error while loading /home/racke/sympa-community/sympa-rest-api/bin/app.psgi: Modification of a read-only value attempted at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 113.
 at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Dancer2/Plugin/OpenAPIRoutes.pm line 260.
    Dancer2::Plugin::OpenAPIRoutes::__ANON__("Modification of a read-only value attempted at /home/racke/pe"...) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 113
    Data::Walk::__recurse(HASH(0x5591ad907230), JSON::PP::Boolean=SCALAR(0x5591ad70ebc8)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 172
    Data::Walk::__recurse(HASH(0x5591ad907230), HASH(0x5591ad820770)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 172
    Data::Walk::__recurse(HASH(0x5591ad907230), ARRAY(0x5591ad60ed20)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 172
    Data::Walk::__recurse(HASH(0x5591ad907230), HASH(0x5591ad8a5c88)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 172
    Data::Walk::__recurse(HASH(0x5591ad907230), HASH(0x5591ad8153b8)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 172
    Data::Walk::__recurse(HASH(0x5591ad907230), HASH(0x5591ad74ea88)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 172
    Data::Walk::__recurse(HASH(0x5591ad907230), HASH(0x5591ad8d1170)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 91
    Data::Walk::__walk(HASH(0x5591ad907230), HASH(0x5591ad8d1170)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Data/Walk.pm line 64
    Data::Walk::walkdepth(HASH(0x5591ad907230), HASH(0x5591ad8d1170)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Dancer2/Plugin/OpenAPIRoutes.pm line 161
    Dancer2::Plugin::OpenAPIRoutes::load_schema(HASH(0x5591ad806c40)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Dancer2/Plugin/OpenAPIRoutes.pm line 264
    Dancer2::Plugin::OpenAPIRoutes::__ANON__(Dancer2::Plugin::OpenAPIRoutes=HASH(0x5591ad6b5510), 1) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Dancer2/Plugin.pm line 569
    Dancer2::Plugin::__ANON__(1) called at /home/racke/sympa-community/sympa-rest-api/bin/../lib/Sympa/REST/API.pm line 5
    require Sympa/REST/API.pm called at /home/racke/sympa-community/sympa-rest-api/bin/app.psgi line 10
    Plack::Sandbox::_2fhome_2fracke_2fsympa_2dcommunity_2fsympa_2drest_2dapi_2fbin_2fapp_2epsgi::BEGIN() called at /home/racke/sympa-community/sympa-rest-api/bin/../lib/Sympa/REST/API.pm line 0
    eval {...} called at /home/racke/sympa-community/sympa-rest-api/bin/../lib/Sympa/REST/API.pm line 0
    require /home/racke/sympa-community/sympa-rest-api/bin/app.psgi called at (eval 8) line 3
    eval 'package Plack::Sandbox::_2fhome_2fracke_2fsympa_2dcommunity_2fsympa_2drest_2dapi_2fbin_2fapp_2epsgi;
{
    my $app = do $_file;
    if ( !$app && ( my $error = $@ || $! )) { die $error; }
    $app;
}
' called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Util.pm line 120
    Plack::Util::_load_sandbox("/home/racke/sympa-community/sympa-rest-api/bin/app.psgi") called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Util.pm line 136
    Plack::Util::load_psgi("bin/app.psgi") called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Runner.pm line 179
    Plack::Runner::__ANON__() called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Runner.pm line 24
    Plack::Runner::__ANON__() called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Runner.pm line 24
    Plack::Runner::__ANON__() called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Runner.pm line 24
    Plack::Runner::__ANON__() called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Runner.pm line 24
    Plack::Runner::__ANON__() called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Loader.pm line 55
    Plack::Loader::preload_app(Plack::Loader=HASH(0x5591ab39df58), CODE(0x5591ab7314d0)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/Plack/Runner.pm line 274
    Plack::Runner::run(Plack::Runner=HASH(0x5591ab39deb0)) called at /home/racke/perl5/perlbrew/perls/perl-5.24.0/bin/plackup line 7
Compilation failed in require at /home/racke/sympa-community/sympa-rest-api/bin/app.psgi line 10.
BEGIN failed--compilation aborted at /home/racke/sympa-community/sympa-rest-api/bin/app.psgi line 10.
racke commented 6 years ago

It looks like that it crashes onrequired: false.

racke commented 6 years ago

That is apparently a bug in Data::Walk (see https://rt.cpan.org/Public/Bug/Display.html?id=114516).

jef-sure commented 6 years ago

Yes, it looks like a bug in Data::Walk. As workaround I suggest to convert your scheme to YAML. I personally find YAML format more pretty and readable.

jef-sure commented 6 years ago

I won't close this issue. Probably I'll implement Data::Walk functionality myself.

racke commented 6 years ago

That makes sense to me. Thanks a lot for your quick responses. :+1: