jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
56 stars 58 forks source link

fix copy required #166

Closed sklukin closed 5 years ago

sklukin commented 5 years ago

Hello required dont copy

   my $joi = joi->object->props(
        some1 => joi->string->enum([qw/asf fgfg/])->required,
        some2 => joi->string->min(1)->required,
    );
    my $joi_recipient = joi->object->props(
        some3 => joi->object->props(
            some4 => joi->string->min(1)->required,  
            some5 => joi->string->enum([qw/asfd dfdf/]->required
        )
    );
    $joi = $joi->extend( $joi_recipient );

required was in first $joi dont by in finish $joi

my $new_joi = $joi->extend($joi); Will extend $joi with the definitions in $joi and return a new object.

It is not clear which will be expanded - $jio or $jio ))

my $new_joi = $joi->extend($joi_new); I think that $joi_new added to $joi and $joi_new remained the same as before

I added the second to the first, and the second remained the same. Not this way?

rebless $self in extend. Why?

sklukin commented 5 years ago

Thanks very much ))