line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Schema::AsType::Draft4; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Role processing draft4 JSON Schema |
4
|
|
|
|
|
|
|
$JSON::Schema::AsType::Draft4::VERSION = '0.4.3'; |
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
7057
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
278
|
|
7
|
9
|
|
|
9
|
|
51
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
263
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
47
|
use Moose::Role; |
|
9
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
84
|
|
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
49645
|
use Type::Utils; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
110
|
|
12
|
9
|
|
|
9
|
|
13219
|
use Scalar::Util qw/ looks_like_number /; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
550
|
|
13
|
9
|
|
|
9
|
|
55
|
use List::Util qw/ reduce pairmap pairs /; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
596
|
|
14
|
9
|
|
|
9
|
|
57
|
use List::MoreUtils qw/ any all none uniq zip /; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
72
|
|
15
|
9
|
|
|
9
|
|
8239
|
use Types::Standard qw/InstanceOf HashRef StrictNum Any Str ArrayRef Int slurpy Dict Optional slurpy /; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
90
|
|
16
|
|
|
|
|
|
|
|
17
|
9
|
|
|
9
|
|
15758
|
use JSON; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
73
|
|
18
|
|
|
|
|
|
|
|
19
|
9
|
|
|
9
|
|
1179
|
use JSON::Schema::AsType; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
228
|
|
20
|
|
|
|
|
|
|
|
21
|
9
|
|
|
9
|
|
2812
|
use JSON::Schema::AsType::Draft4::Types '-all'; |
|
9
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
107
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
override all_keywords => sub { |
24
|
|
|
|
|
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# $ref trumps all |
27
|
|
|
|
|
|
|
return '$ref' if $self->schema->{'$ref'}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return uniq 'id', super(); |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->add_method( '_keyword_$ref' => sub { |
33
|
805
|
|
|
805
|
|
3144
|
my( $self, $ref ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return Type::Tiny->new( |
36
|
|
|
|
|
|
|
name => 'Ref', |
37
|
|
|
|
|
|
|
display_name => "Ref($ref)", |
38
|
|
|
|
|
|
|
constraint => sub { |
39
|
|
|
|
|
|
|
|
40
|
1542
|
|
|
1542
|
|
230683
|
my $r = $self->resolve_reference($ref); |
41
|
|
|
|
|
|
|
|
42
|
1542
|
|
|
|
|
99821
|
$r->check($_); |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
message => sub { |
45
|
12
|
|
|
12
|
|
2436
|
my $schema = $self->resolve_reference($ref); |
46
|
|
|
|
|
|
|
|
47
|
12
|
|
|
|
|
732
|
join "\n", "ref schema is " . to_json($schema->schema, { allow_nonref => 1 }), @{$schema->validate_explain($_)} |
|
12
|
|
|
|
|
887
|
|
48
|
|
|
|
|
|
|
} |
49
|
805
|
|
|
|
|
12636
|
); |
50
|
|
|
|
|
|
|
} ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _keyword_id { |
53
|
411
|
|
|
411
|
|
1560
|
my( $self, $id ) = @_; |
54
|
|
|
|
|
|
|
|
55
|
411
|
100
|
|
|
|
10105
|
unless( $self->uri ) { |
56
|
396
|
|
|
|
|
5245
|
my $id = $self->absolute_id($id); |
57
|
396
|
|
|
|
|
8517
|
$self->uri($id); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
411
|
|
|
|
|
11200
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _keyword_definitions { |
64
|
70
|
|
|
70
|
|
229
|
my( $self, $defs ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
70
|
|
|
|
|
500
|
$self->sub_schema( $_ ) for values %$defs; |
67
|
|
|
|
|
|
|
|
68
|
70
|
|
|
|
|
12418
|
return; |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _keyword_pattern { |
72
|
38
|
|
|
38
|
|
125
|
my( $self, $pattern ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
38
|
|
|
|
|
213
|
Pattern[$pattern]; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _keyword_enum { |
78
|
269
|
|
|
269
|
|
747
|
my( $self, $enum ) = @_; |
79
|
|
|
|
|
|
|
|
80
|
269
|
|
|
|
|
1866
|
Enum[@$enum]; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _keyword_uniqueItems { |
84
|
150
|
|
|
150
|
|
484
|
my( $self, $unique ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
150
|
50
|
|
|
|
1082
|
return unless $unique; # unique false? all is good |
87
|
|
|
|
|
|
|
|
88
|
150
|
|
|
|
|
1941
|
return UniqueItems; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _keyword_dependencies { |
92
|
12
|
|
|
12
|
|
49
|
my( $self, $dependencies ) = @_; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
return Dependencies[ |
95
|
12
|
100
|
|
21
|
|
156
|
pairmap { $a => ref $b eq 'HASH' ? $self->sub_schema($b) : $b } %$dependencies |
|
21
|
|
|
|
|
161
|
|
96
|
|
|
|
|
|
|
]; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _keyword_additionalProperties { |
101
|
67
|
|
|
67
|
|
241
|
my( $self, $addi ) = @_; |
102
|
|
|
|
|
|
|
|
103
|
67
|
|
|
|
|
155
|
my $add_schema; |
104
|
67
|
100
|
|
|
|
505
|
$add_schema = $self->sub_schema($addi) if ref $addi eq 'HASH'; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my @known_keys = ( |
107
|
67
|
|
|
|
|
158
|
eval { keys %{ $self->schema->{properties} } }, |
|
67
|
|
|
|
|
1440
|
|
108
|
67
|
|
|
|
|
1730
|
map { qr/$_/ } eval { keys %{ $self->schema->{patternProperties} } } ); |
|
6
|
|
|
|
|
195
|
|
|
67
|
|
|
|
|
758
|
|
|
67
|
|
|
|
|
1363
|
|
109
|
|
|
|
|
|
|
|
110
|
67
|
100
|
|
|
|
2027
|
return AdditionalProperties[ \@known_keys, $add_schema ? $add_schema->type : $addi ]; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub _keyword_patternProperties { |
114
|
77
|
|
|
77
|
|
308
|
my( $self, $properties ) = @_; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my %prop_schemas = pairmap { |
117
|
23
|
|
|
23
|
|
521
|
$a => $self->sub_schema($b)->type |
118
|
77
|
|
|
|
|
914
|
} %$properties; |
119
|
|
|
|
|
|
|
|
120
|
77
|
|
|
|
|
1513
|
return PatternProperties[ %prop_schemas ]; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _keyword_properties { |
124
|
547
|
|
|
547
|
|
1873
|
my( $self, $properties ) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Properties[ |
127
|
|
|
|
|
|
|
pairmap { |
128
|
1262
|
|
|
1262
|
|
30013
|
my $schema = $self->sub_schema($b); |
129
|
1262
|
|
|
|
|
66336
|
$a => $schema->type; |
130
|
547
|
|
|
|
|
7320
|
} %$properties |
131
|
|
|
|
|
|
|
]; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _keyword_maxProperties { |
136
|
2
|
|
|
2
|
|
7
|
my( $self, $max ) = @_; |
137
|
|
|
|
|
|
|
|
138
|
2
|
|
|
|
|
11
|
MaxProperties[ $max ]; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub _keyword_minProperties { |
142
|
2
|
|
|
2
|
|
8
|
my( $self, $min ) = @_; |
143
|
|
|
|
|
|
|
|
144
|
2
|
|
|
|
|
13
|
MinProperties[ $min ]; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub _keyword_required { |
148
|
420
|
|
|
420
|
|
1425
|
my( $self, $required ) = @_; |
149
|
|
|
|
|
|
|
|
150
|
420
|
|
|
|
|
2828
|
Required[@$required]; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub _keyword_not { |
154
|
10
|
|
|
10
|
|
38
|
my( $self, $schema ) = @_; |
155
|
10
|
|
|
|
|
48
|
Not[ $self->sub_schema($schema) ]; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub _keyword_oneOf { |
159
|
9
|
|
|
9
|
|
34
|
my( $self, $options ) = @_; |
160
|
|
|
|
|
|
|
|
161
|
9
|
|
|
|
|
30
|
OneOf[ map { $self->sub_schema( $_ ) } @$options ]; |
|
52
|
|
|
|
|
1373
|
|
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub _keyword_anyOf { |
166
|
70
|
|
|
70
|
|
373
|
my( $self, $options ) = @_; |
167
|
|
|
|
|
|
|
|
168
|
70
|
|
|
|
|
243
|
AnyOf[ map { $self->sub_schema($_)->type } @$options ]; |
|
140
|
|
|
|
|
9126
|
|
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub _keyword_allOf { |
172
|
30
|
|
|
30
|
|
112
|
my( $self, $options ) = @_; |
173
|
|
|
|
|
|
|
|
174
|
30
|
|
|
|
|
107
|
AllOf[ map { $self->sub_schema($_)->type } @$options ]; |
|
61
|
|
|
|
|
3704
|
|
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub _keyword_type { |
178
|
1591
|
|
|
1591
|
|
5134
|
my( $self, $struct_type ) = @_; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
my %keyword_map = map { |
181
|
1591
|
|
|
|
|
7421
|
lc $_->name => $_ |
|
11137
|
|
|
|
|
92850
|
|
182
|
|
|
|
|
|
|
} Integer, Number, String, Object, Array, Boolean, Null; |
183
|
|
|
|
|
|
|
|
184
|
1591
|
100
|
|
|
|
57206
|
unless( $self->strict_string ) { |
185
|
9
|
|
|
|
|
75
|
$keyword_map{number} = LaxNumber; |
186
|
9
|
|
|
|
|
46
|
$keyword_map{integer} = LaxInteger; |
187
|
9
|
|
|
|
|
41
|
$keyword_map{string} = LaxString; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
return $keyword_map{$struct_type} |
192
|
1591
|
100
|
|
|
|
17456
|
if $keyword_map{$struct_type}; |
193
|
|
|
|
|
|
|
|
194
|
6
|
50
|
|
|
|
38
|
if( ref $struct_type eq 'ARRAY' ) { |
195
|
6
|
|
|
|
|
24
|
return AnyOf[map { $self->_keyword_type($_) } @$struct_type]; |
|
12
|
|
|
|
|
92
|
|
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
0
|
return; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub _keyword_multipleOf { |
202
|
6
|
|
|
6
|
|
19
|
my( $self, $num ) = @_; |
203
|
|
|
|
|
|
|
|
204
|
6
|
|
|
|
|
33
|
MultipleOf[$num]; |
205
|
|
|
|
|
|
|
}; |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub _keyword_maxItems { |
208
|
7
|
|
|
7
|
|
27
|
my( $self, $max ) = @_; |
209
|
|
|
|
|
|
|
|
210
|
7
|
|
|
|
|
42
|
MaxItems[$max]; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub _keyword_minItems { |
214
|
160
|
|
|
160
|
|
468
|
my( $self, $min ) = @_; |
215
|
|
|
|
|
|
|
|
216
|
160
|
|
|
|
|
853
|
MinItems[$min]; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub _keyword_maxLength { |
220
|
8
|
|
|
8
|
|
31
|
my( $self, $max ) = @_; |
221
|
|
|
|
|
|
|
|
222
|
8
|
|
|
|
|
60
|
MaxLength[$max]; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub _keyword_minLength { |
226
|
10
|
|
|
10
|
|
37
|
my( $self, $min ) = @_; |
227
|
|
|
|
|
|
|
|
228
|
10
|
|
|
|
|
112
|
return MinLength[$min]; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub _keyword_maximum { |
232
|
13
|
|
|
13
|
|
54
|
my( $self, $maximum ) = @_; |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
return $self->schema->{exclusiveMaximum} |
235
|
13
|
100
|
|
|
|
308
|
? ExclusiveMaximum[$maximum] |
236
|
|
|
|
|
|
|
: Maximum[$maximum]; |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
sub _keyword_minimum { |
241
|
67
|
|
|
67
|
|
234
|
my( $self, $minimum ) = @_; |
242
|
|
|
|
|
|
|
|
243
|
67
|
100
|
|
|
|
1419
|
if ( $self->schema->{exclusiveMinimum} ) { |
244
|
15
|
|
|
|
|
395
|
return ExclusiveMinimum[$minimum]; |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
52
|
|
|
|
|
837
|
return Minimum[$minimum]; |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub _keyword_additionalItems { |
251
|
12
|
|
|
12
|
|
38
|
my( $self, $s ) = @_; |
252
|
|
|
|
|
|
|
|
253
|
12
|
100
|
|
|
|
66
|
unless($s) { |
254
|
9
|
100
|
|
|
|
254
|
my $items = $self->schema->{items} or return; |
255
|
6
|
100
|
|
|
|
81
|
return if ref $items eq 'HASH'; # it's a schema, nevermind |
256
|
3
|
|
|
|
|
11
|
my $size = @$items; |
257
|
|
|
|
|
|
|
|
258
|
3
|
|
|
|
|
18
|
return AdditionalItems[$size]; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
3
|
|
|
|
|
15
|
my $schema = $self->sub_schema($s); |
262
|
|
|
|
|
|
|
|
263
|
3
|
|
|
|
|
53
|
my $to_skip = @{ $self->schema->{items} }; |
|
3
|
|
|
|
|
64
|
|
264
|
|
|
|
|
|
|
|
265
|
3
|
|
|
|
|
42
|
return AdditionalItems[$to_skip,$schema]; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub _keyword_items { |
270
|
217
|
|
|
217
|
|
678
|
my( $self, $items ) = @_; |
271
|
|
|
|
|
|
|
|
272
|
217
|
50
|
|
|
|
980
|
if ( Boolean->check($items) ) { |
273
|
0
|
|
|
|
|
0
|
return Items[$items]; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
217
|
100
|
|
|
|
1612
|
if( ref $items eq 'HASH' ) { |
277
|
207
|
|
|
|
|
1028
|
my $type = $self->sub_schema($items)->type; |
278
|
|
|
|
|
|
|
|
279
|
207
|
|
|
|
|
9969
|
return Items[$type]; |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# TODO forward declaration not workie |
283
|
10
|
|
|
|
|
24
|
my @types; |
284
|
10
|
|
|
|
|
34
|
for ( @$items ) { |
285
|
16
|
|
|
|
|
1207
|
push @types, $self->sub_schema($_)->type; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
10
|
|
|
|
|
1064
|
return Items[\@types]; |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
JSON::Schema::AsType->new( |
292
|
|
|
|
|
|
|
specification => 'draft4', |
293
|
|
|
|
|
|
|
uri => 'http://json-schema.org/draft-04/schema', |
294
|
|
|
|
|
|
|
schema => from_json <<'END_JSON' )->type; |
295
|
|
|
|
|
|
|
{ |
296
|
|
|
|
|
|
|
"id": "http://json-schema.org/draft-04/schema#", |
297
|
|
|
|
|
|
|
"$schema": "http://json-schema.org/draft-04/schema#", |
298
|
|
|
|
|
|
|
"description": "Core schema meta-schema", |
299
|
|
|
|
|
|
|
"definitions": { |
300
|
|
|
|
|
|
|
"schemaArray": { |
301
|
|
|
|
|
|
|
"type": "array", |
302
|
|
|
|
|
|
|
"minItems": 1, |
303
|
|
|
|
|
|
|
"items": { "$ref": "#" } |
304
|
|
|
|
|
|
|
}, |
305
|
|
|
|
|
|
|
"positiveInteger": { |
306
|
|
|
|
|
|
|
"type": "integer", |
307
|
|
|
|
|
|
|
"minimum": 0 |
308
|
|
|
|
|
|
|
}, |
309
|
|
|
|
|
|
|
"positiveIntegerDefault0": { |
310
|
|
|
|
|
|
|
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] |
311
|
|
|
|
|
|
|
}, |
312
|
|
|
|
|
|
|
"simpleTypes": { |
313
|
|
|
|
|
|
|
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] |
314
|
|
|
|
|
|
|
}, |
315
|
|
|
|
|
|
|
"stringArray": { |
316
|
|
|
|
|
|
|
"type": "array", |
317
|
|
|
|
|
|
|
"items": { "type": "string" }, |
318
|
|
|
|
|
|
|
"minItems": 1, |
319
|
|
|
|
|
|
|
"uniqueItems": true |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
}, |
322
|
|
|
|
|
|
|
"type": "object", |
323
|
|
|
|
|
|
|
"properties": { |
324
|
|
|
|
|
|
|
"id": { |
325
|
|
|
|
|
|
|
"type": "string", |
326
|
|
|
|
|
|
|
"format": "uri" |
327
|
|
|
|
|
|
|
}, |
328
|
|
|
|
|
|
|
"$schema": { |
329
|
|
|
|
|
|
|
"type": "string", |
330
|
|
|
|
|
|
|
"format": "uri" |
331
|
|
|
|
|
|
|
}, |
332
|
|
|
|
|
|
|
"title": { |
333
|
|
|
|
|
|
|
"type": "string" |
334
|
|
|
|
|
|
|
}, |
335
|
|
|
|
|
|
|
"description": { |
336
|
|
|
|
|
|
|
"type": "string" |
337
|
|
|
|
|
|
|
}, |
338
|
|
|
|
|
|
|
"default": {}, |
339
|
|
|
|
|
|
|
"multipleOf": { |
340
|
|
|
|
|
|
|
"type": "number", |
341
|
|
|
|
|
|
|
"minimum": 0, |
342
|
|
|
|
|
|
|
"exclusiveMinimum": true |
343
|
|
|
|
|
|
|
}, |
344
|
|
|
|
|
|
|
"maximum": { |
345
|
|
|
|
|
|
|
"type": "number" |
346
|
|
|
|
|
|
|
}, |
347
|
|
|
|
|
|
|
"exclusiveMaximum": { |
348
|
|
|
|
|
|
|
"type": "boolean", |
349
|
|
|
|
|
|
|
"default": false |
350
|
|
|
|
|
|
|
}, |
351
|
|
|
|
|
|
|
"minimum": { |
352
|
|
|
|
|
|
|
"type": "number" |
353
|
|
|
|
|
|
|
}, |
354
|
|
|
|
|
|
|
"exclusiveMinimum": { |
355
|
|
|
|
|
|
|
"type": "boolean", |
356
|
|
|
|
|
|
|
"default": false |
357
|
|
|
|
|
|
|
}, |
358
|
|
|
|
|
|
|
"maxLength": { "$ref": "#/definitions/positiveInteger" }, |
359
|
|
|
|
|
|
|
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, |
360
|
|
|
|
|
|
|
"pattern": { |
361
|
|
|
|
|
|
|
"type": "string", |
362
|
|
|
|
|
|
|
"format": "regex" |
363
|
|
|
|
|
|
|
}, |
364
|
|
|
|
|
|
|
"additionalItems": { |
365
|
|
|
|
|
|
|
"anyOf": [ |
366
|
|
|
|
|
|
|
{ "type": "boolean" }, |
367
|
|
|
|
|
|
|
{ "$ref": "#" } |
368
|
|
|
|
|
|
|
], |
369
|
|
|
|
|
|
|
"default": {} |
370
|
|
|
|
|
|
|
}, |
371
|
|
|
|
|
|
|
"items": { |
372
|
|
|
|
|
|
|
"anyOf": [ |
373
|
|
|
|
|
|
|
{ "$ref": "#" }, |
374
|
|
|
|
|
|
|
{ "$ref": "#/definitions/schemaArray" } |
375
|
|
|
|
|
|
|
], |
376
|
|
|
|
|
|
|
"default": {} |
377
|
|
|
|
|
|
|
}, |
378
|
|
|
|
|
|
|
"maxItems": { "$ref": "#/definitions/positiveInteger" }, |
379
|
|
|
|
|
|
|
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, |
380
|
|
|
|
|
|
|
"uniqueItems": { |
381
|
|
|
|
|
|
|
"type": "boolean", |
382
|
|
|
|
|
|
|
"default": false |
383
|
|
|
|
|
|
|
}, |
384
|
|
|
|
|
|
|
"maxProperties": { "$ref": "#/definitions/positiveInteger" }, |
385
|
|
|
|
|
|
|
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, |
386
|
|
|
|
|
|
|
"required": { "$ref": "#/definitions/stringArray" }, |
387
|
|
|
|
|
|
|
"additionalProperties": { |
388
|
|
|
|
|
|
|
"anyOf": [ |
389
|
|
|
|
|
|
|
{ "type": "boolean" }, |
390
|
|
|
|
|
|
|
{ "$ref": "#" } |
391
|
|
|
|
|
|
|
], |
392
|
|
|
|
|
|
|
"default": {} |
393
|
|
|
|
|
|
|
}, |
394
|
|
|
|
|
|
|
"definitions": { |
395
|
|
|
|
|
|
|
"type": "object", |
396
|
|
|
|
|
|
|
"additionalProperties": { "$ref": "#" }, |
397
|
|
|
|
|
|
|
"default": {} |
398
|
|
|
|
|
|
|
}, |
399
|
|
|
|
|
|
|
"properties": { |
400
|
|
|
|
|
|
|
"type": "object", |
401
|
|
|
|
|
|
|
"additionalProperties": { "$ref": "#" }, |
402
|
|
|
|
|
|
|
"default": {} |
403
|
|
|
|
|
|
|
}, |
404
|
|
|
|
|
|
|
"patternProperties": { |
405
|
|
|
|
|
|
|
"type": "object", |
406
|
|
|
|
|
|
|
"additionalProperties": { "$ref": "#" }, |
407
|
|
|
|
|
|
|
"default": {} |
408
|
|
|
|
|
|
|
}, |
409
|
|
|
|
|
|
|
"dependencies": { |
410
|
|
|
|
|
|
|
"type": "object", |
411
|
|
|
|
|
|
|
"additionalProperties": { |
412
|
|
|
|
|
|
|
"anyOf": [ |
413
|
|
|
|
|
|
|
{ "$ref": "#" }, |
414
|
|
|
|
|
|
|
{ "$ref": "#/definitions/stringArray" } |
415
|
|
|
|
|
|
|
] |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
}, |
418
|
|
|
|
|
|
|
"enum": { |
419
|
|
|
|
|
|
|
"type": "array", |
420
|
|
|
|
|
|
|
"minItems": 1, |
421
|
|
|
|
|
|
|
"uniqueItems": true |
422
|
|
|
|
|
|
|
}, |
423
|
|
|
|
|
|
|
"type": { |
424
|
|
|
|
|
|
|
"anyOf": [ |
425
|
|
|
|
|
|
|
{ "$ref": "#/definitions/simpleTypes" }, |
426
|
|
|
|
|
|
|
{ |
427
|
|
|
|
|
|
|
"type": "array", |
428
|
|
|
|
|
|
|
"items": { "$ref": "#/definitions/simpleTypes" }, |
429
|
|
|
|
|
|
|
"minItems": 1, |
430
|
|
|
|
|
|
|
"uniqueItems": true |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
] |
433
|
|
|
|
|
|
|
}, |
434
|
|
|
|
|
|
|
"allOf": { "$ref": "#/definitions/schemaArray" }, |
435
|
|
|
|
|
|
|
"anyOf": { "$ref": "#/definitions/schemaArray" }, |
436
|
|
|
|
|
|
|
"oneOf": { "$ref": "#/definitions/schemaArray" }, |
437
|
|
|
|
|
|
|
"not": { "$ref": "#" } |
438
|
|
|
|
|
|
|
}, |
439
|
|
|
|
|
|
|
"dependencies": { |
440
|
|
|
|
|
|
|
"exclusiveMaximum": [ "maximum" ], |
441
|
|
|
|
|
|
|
"exclusiveMinimum": [ "minimum" ] |
442
|
|
|
|
|
|
|
}, |
443
|
|
|
|
|
|
|
"default": {} |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
END_JSON |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
1; |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
__END__ |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=pod |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=encoding UTF-8 |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=head1 NAME |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
JSON::Schema::AsType::Draft4 - Role processing draft4 JSON Schema |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=head1 VERSION |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
version 0.4.3 |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=head1 DESCRIPTION |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
This role is not intended to be used directly. It is used internally |
466
|
|
|
|
|
|
|
by L<JSON::Schema::AsType> objects. |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
Importing this module auto-populate the Draft4 schema in the |
469
|
|
|
|
|
|
|
L<JSON::Schema::AsType> schema cache. |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=head1 AUTHOR |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
Yanick Champoux <yanick@babyl.dyndns.org> |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
This software is copyright (c) 2017, 2015 by Yanick Champoux. |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
480
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=cut |