use
5.020;
no
autovivification
warn
=>
qw(fetch store exists delete)
;
use
if
"$]"
>= 5.022,
experimental
=>
're_strict'
;
no
if
"$]"
>= 5.031009,
feature
=>
'indirect'
;
no
if
"$]"
>= 5.033001,
feature
=>
'multidimensional'
;
no
if
"$]"
>= 5.033006,
feature
=>
'bareword_filehandles'
;
use
if
"$]"
>= 5.022,
experimental
=>
're_strict'
;
use
open
':std'
,
':encoding(UTF-8)'
;
my
$js
= JSON::Schema::Modern->new;
cmp_result(
$js
->validate_schema({
type
=>
'bloop'
})->TO_JSON,
{
valid
=> false,
errors
=> supersetof(
{
instanceLocation
=>
'/type'
,
keywordLocation
=> re(
qr{/enum$}
),
error
=>
'value does not match'
,
},
),
},
'validate_schema on simple schema with no $schema keyword'
,
);
cmp_result(
$js
->validate_schema({
type
=>
'bloop'
,
})->TO_JSON,
{
valid
=> false,
errors
=> supersetof(
{
instanceLocation
=>
'/type'
,
keywordLocation
=> re(
qr{/enum$}
),
error
=>
'value does not match'
,
},
),
},
'validate_schema on schema with metaschema $schema keyword'
,
);
cmp_result(
$js
->validate_schema({
type
=>
'bloop'
,
})->TO_JSON,
{
valid
=> false,
errors
=> [
{
instanceLocation
=>
''
,
keywordLocation
=>
'/type'
,
error
=>
'got object, not boolean'
,
},
],
},
'validate_schema with custom metaschema'
,
);
done_testing;