| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
48939
|
use 5.036; |
|
|
2
|
|
|
|
|
10
|
|
|
2
|
2
|
|
|
2
|
|
14
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
55
|
|
|
3
|
2
|
|
|
2
|
|
19
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
124
|
|
|
4
|
2
|
|
|
2
|
|
1466
|
use experimental 'builtin'; |
|
|
2
|
|
|
|
|
10844
|
|
|
|
2
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Types::JSONSchema::PrimativeTypes; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
9
|
|
|
|
|
|
|
our $VERSION = '0.001000'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Type::Library |
|
12
|
2
|
|
|
|
|
59
|
-base, |
|
13
|
|
|
|
|
|
|
-declare => qw/ |
|
14
|
|
|
|
|
|
|
JNull |
|
15
|
|
|
|
|
|
|
JBoolean |
|
16
|
|
|
|
|
|
|
JObject |
|
17
|
|
|
|
|
|
|
JArray |
|
18
|
|
|
|
|
|
|
JNumber |
|
19
|
|
|
|
|
|
|
JString |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
JTrue |
|
22
|
|
|
|
|
|
|
JFalse |
|
23
|
|
|
|
|
|
|
JInteger |
|
24
|
|
|
|
|
|
|
JAny |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
JSPrimativeName |
|
27
|
|
|
|
|
|
|
JSPrimativeType |
|
28
|
2
|
|
|
2
|
|
454
|
/; |
|
|
2
|
|
|
|
|
6
|
|
|
29
|
2
|
|
|
2
|
|
9653
|
use Types::Common -all; |
|
|
2
|
|
|
|
|
594126
|
|
|
|
2
|
|
|
|
|
24
|
|
|
30
|
2
|
|
|
2
|
|
223084
|
use Type::Utils; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
31
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
declare JNull, |
|
33
|
|
|
|
|
|
|
as Undef; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
declare JBoolean, |
|
36
|
|
|
|
|
|
|
as InstanceOf[ 'boolean', 'JSON::PP::Boolean', 'JSON::XS::Boolean' ] |
|
37
|
|
|
|
|
|
|
| ScalarRef[ Enum[ 0, 1 ] ] |
|
38
|
|
|
|
|
|
|
| Value->create_child_type( |
|
39
|
|
|
|
|
|
|
name => 'PerlNativeBoolean', |
|
40
|
|
|
|
|
|
|
constraint => sub { builtin::is_bool($_) }, |
|
41
|
|
|
|
|
|
|
inlined => sub { my $var = pop; qq{do{ use experimental 'builtin'; builtin::is_bool($var) }} }, |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
declare JTrue, |
|
45
|
|
|
|
|
|
|
as JBoolean, |
|
46
|
|
|
|
|
|
|
where { ( 'SCALAR' eq ( ref $_ or '' ) ) ? $$_ : $_ }, |
|
47
|
|
|
|
|
|
|
inline_as { |
|
48
|
|
|
|
|
|
|
my $var = $_; |
|
49
|
|
|
|
|
|
|
my $parent = $_[0]->parent->inline_check( $var ); |
|
50
|
|
|
|
|
|
|
qq{$parent and ( 'SCALAR' eq ( ref $var or '' ) ) ? \${$var} : $var} |
|
51
|
|
|
|
|
|
|
}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
declare JFalse, |
|
54
|
|
|
|
|
|
|
as JBoolean, |
|
55
|
|
|
|
|
|
|
where { ( 'SCALAR' eq ( ref $_ or '' ) ) ? !$$_ : !$_ }, |
|
56
|
|
|
|
|
|
|
inline_as { |
|
57
|
|
|
|
|
|
|
my $var = $_; |
|
58
|
|
|
|
|
|
|
my $parent = $_[0]->parent->inline_check( $var ); |
|
59
|
|
|
|
|
|
|
qq{$parent and ( 'SCALAR' eq ( ref $var or '' ) ) ? !\${$var} : !$var} |
|
60
|
|
|
|
|
|
|
}; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
declare JObject, |
|
63
|
|
|
|
|
|
|
as HashRef; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
declare JArray, |
|
66
|
|
|
|
|
|
|
as ArrayRef; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
declare JNumber, |
|
69
|
|
|
|
|
|
|
as Num, |
|
70
|
|
|
|
|
|
|
where { builtin::created_as_number( $_ ) }, |
|
71
|
|
|
|
|
|
|
inline_as { ( Value->inline_check($_), qq{do{ use experimental 'builtin'; builtin::created_as_number( $_ ) }} ) }; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
declare JInteger, |
|
74
|
|
|
|
|
|
|
as JNumber, |
|
75
|
|
|
|
|
|
|
where { int($_) == $_ }, |
|
76
|
|
|
|
|
|
|
inline_as { ( undef, qq{int($_) == $_} ) }; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
declare JString, |
|
79
|
|
|
|
|
|
|
as Str, |
|
80
|
|
|
|
|
|
|
where { builtin::created_as_string( $_ ) }, |
|
81
|
|
|
|
|
|
|
inline_as { ( Value->inline_check($_), qq{do{ use experimental 'builtin'; builtin::created_as_string( $_ ) }} ) }; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
declare JAny, |
|
84
|
|
|
|
|
|
|
as JNull | JBoolean | JObject | JArray | JNumber | JString; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my %primative_name_to_type = ( |
|
87
|
|
|
|
|
|
|
null => JNull, |
|
88
|
|
|
|
|
|
|
boolean => JBoolean, |
|
89
|
|
|
|
|
|
|
object => JObject, |
|
90
|
|
|
|
|
|
|
array => JArray, |
|
91
|
|
|
|
|
|
|
number => JNumber, |
|
92
|
|
|
|
|
|
|
string => JString, |
|
93
|
|
|
|
|
|
|
); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
declare JSPrimativeName, |
|
96
|
|
|
|
|
|
|
as Enum[ sort keys %primative_name_to_type ]; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
declare JSPrimativeType, |
|
99
|
|
|
|
|
|
|
as InstanceOf->of('Type::Tiny')->with_attribute_values( |
|
100
|
|
|
|
|
|
|
library => Enum[ 'Types::JSONSchema::PrimativeTypes' ], |
|
101
|
|
|
|
|
|
|
name => Enum[ sort map $_->name, values %primative_name_to_type ], |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
coerce JSPrimativeType, |
|
105
|
|
|
|
|
|
|
from JSPrimativeName, via { $primative_name_to_type{$_} }, |
|
106
|
|
|
|
|
|
|
from Enum['integer'], via { JInteger }; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__END__ |