line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
20
|
|
|
20
|
|
13395
|
use strict; |
|
20
|
|
|
|
|
53
|
|
|
20
|
|
|
|
|
717
|
|
2
|
20
|
|
|
20
|
|
118
|
use warnings; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
1280
|
|
3
|
|
|
|
|
|
|
package JSON::Schema::Draft201909::Vocabulary::Content; |
4
|
|
|
|
|
|
|
# vim: set ts=8 sts=2 sw=2 tw=100 et : |
5
|
|
|
|
|
|
|
# ABSTRACT: Implementation of the JSON Schema Draft 2019-09 Content vocabulary |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.028'; |
8
|
|
|
|
|
|
|
|
9
|
20
|
|
|
20
|
|
404
|
use 5.016; |
|
20
|
|
|
|
|
82
|
|
10
|
20
|
|
|
20
|
|
132
|
no if "$]" >= 5.031009, feature => 'indirect'; |
|
20
|
|
|
|
|
63
|
|
|
20
|
|
|
|
|
229
|
|
11
|
20
|
|
|
20
|
|
1038
|
no if "$]" >= 5.033001, feature => 'multidimensional'; |
|
20
|
|
|
|
|
59
|
|
|
20
|
|
|
|
|
129
|
|
12
|
20
|
|
|
20
|
|
1060
|
no if "$]" >= 5.033006, feature => 'bareword_filehandles'; |
|
20
|
|
|
|
|
58
|
|
|
20
|
|
|
|
|
122
|
|
13
|
20
|
|
|
20
|
|
897
|
use strictures 2; |
|
20
|
|
|
|
|
169
|
|
|
20
|
|
|
|
|
827
|
|
14
|
20
|
|
|
20
|
|
4309
|
use Storable 'dclone'; |
|
20
|
|
|
|
|
64
|
|
|
20
|
|
|
|
|
1493
|
|
15
|
20
|
|
|
20
|
|
154
|
use JSON::Schema::Draft201909::Utilities qw(is_type A assert_keyword_type); |
|
20
|
|
|
|
|
67
|
|
|
20
|
|
|
|
|
1347
|
|
16
|
20
|
|
|
20
|
|
146
|
use Moo; |
|
20
|
|
|
|
|
56
|
|
|
20
|
|
|
|
|
184
|
|
17
|
20
|
|
|
20
|
|
8914
|
use namespace::clean; |
|
20
|
|
|
|
|
63
|
|
|
20
|
|
|
|
|
224
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
with 'JSON::Schema::Draft201909::Vocabulary'; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
0
|
sub vocabulary { 'https://json-schema.org/draft/2019-09/vocab/content' } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub keywords { |
24
|
15106
|
|
|
15106
|
0
|
41361
|
qw(contentEncoding contentMediaType contentSchema); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _traverse_keyword_contentEncoding { |
28
|
60
|
|
|
60
|
|
130
|
my ($self, $schema, $state) = @_; |
29
|
60
|
50
|
|
|
|
156
|
return if not assert_keyword_type($state, $schema, 'string'); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _eval_keyword_contentEncoding { |
33
|
60
|
|
|
60
|
|
150
|
my ($self, $data, $schema, $state) = @_; |
34
|
|
|
|
|
|
|
|
35
|
60
|
100
|
|
|
|
160
|
return 1 if not is_type('string', $data); |
36
|
48
|
|
|
|
|
176
|
return A($state, $schema->{$state->{keyword}}); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
30
|
|
|
30
|
|
94
|
sub _traverse_keyword_contentMediaType { goto \&_traverse_keyword_contentEncoding } |
40
|
|
|
|
|
|
|
|
41
|
30
|
|
|
30
|
|
98
|
sub _eval_keyword_contentMediaType { goto \&_eval_keyword_contentEncoding } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _traverse_keyword_contentSchema { |
44
|
16
|
|
|
16
|
|
33
|
my ($self, $schema, $state) = @_; |
45
|
|
|
|
|
|
|
|
46
|
16
|
50
|
|
|
|
37
|
return if not exists $schema->{contentMediaType}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# since contentSchema should never be evaluated in the context of the containing schema, it is |
49
|
|
|
|
|
|
|
# not appropriate to gather identifiers found therein -- but we can still validate the subschema. |
50
|
16
|
|
|
|
|
179
|
$self->traverse_subschema($schema, +{ %$state, identifiers => [] }); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _eval_keyword_contentSchema { |
54
|
16
|
|
|
16
|
|
40
|
my ($self, $data, $schema, $state) = @_; |
55
|
|
|
|
|
|
|
|
56
|
16
|
50
|
|
|
|
43
|
return 1 if not exists $schema->{contentMediaType}; |
57
|
16
|
100
|
|
|
|
44
|
return 1 if not is_type('string', $data); |
58
|
|
|
|
|
|
|
|
59
|
14
|
|
|
|
|
552
|
return A($state, dclone($schema->{contentSchema})); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=pod |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=encoding UTF-8 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
JSON::Schema::Draft201909::Vocabulary::Content - Implementation of the JSON Schema Draft 2019-09 Content vocabulary |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
version 0.028 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 DESCRIPTION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=for Pod::Coverage vocabulary keywords |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=for stopwords metaschema |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Implementation of the JSON Schema Draft 2019-09 "Content" vocabulary, indicated in metaschemas |
85
|
|
|
|
|
|
|
with the URI C<https://json-schema.org/draft/2019-09/vocab/content> and formally specified in |
86
|
|
|
|
|
|
|
L<https://json-schema.org/draft/2019-09/json-schema-validation.html>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SUPPORT |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Bugs may be submitted through L<https://github.com/karenetheridge/JSON-Schema-Draft201909/issues>. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
I am also usually active on irc, as 'ether' at C<irc.perl.org> and C<irc.libera.chat>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Karen Etheridge. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
103
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |