package Types::JSONSchema;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.001000';
use constant { true => !!1, false => !!0 };
use Type::Library
-extends => [ 'Types::JSONSchema::Primative
FmtUri
FmtUriReference
FmtIri
FmtIriReference
FmtUuid
FmtUriTemplate
FmtJsonPointer
FmtRelativeJsonPointer
FmtRegex
/;
use Types::Common -all;
use Types::Standard::ArrayRef Strings
ur @EXPORT_OK, qw(
json_eq
json_safe_dumper
jpointer_escape
schema_to_type
true
false
);
signature_for json_eq => (
method => false,
pos => [ Any, Any ],
);
sub json_eq ( $x, $y ) {
use 5.036;
use strict;
use warnings;
use experimental 'builtin';
package Types::JSONSchema::PrimativeTypes;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.001000';
use Type::Library
-base,
Type::Utils;
declare JNull,
as Undef;
declare JBoolean,
as InstanceOf[ 'boolean', 'JSON::PP::Boolean', 'JSON::XS::Boolean' ]
| ScalarRef[ Enum[ 0, 1 ] ]
| Value->create_child_type(
name
rimativeType,
as InstanceOf->of('Type::Tiny')->with_attribute_values(
library => Enum[ 'Types::JSONSchema::PrimativeTypes' ],
name => Enum[ sort map $_->name, values %primative_name_to_type ],