blib/lib/JSON/Schema/Generate.pm

filter: Statementstmt 21.8% 28 / 128 Branchbran 0.0% 0 / 58 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 36.0% 9 / 25 Podpod 100% 3 / 3 totaltotal 16.9% 40 / 236 CC 41 SCAR 47.6
CC
41
Cov
14%
_build_props
342.0
_unique_examples
90.0
_handle_required
56.0
CRAP 117.2
↑ Summary
1 package JSON::Schema::Generate;
2 5 ▶use 5.006; use strict; use warnings; our $VERSION = '0.08';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use Tie::IxHash; use Types::Standard qw/Str HashRef Bool/;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Compiled::Params::OO qw/cpo/; use JSON; use Blessed::Merge;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 our ($validate, $JSON);
7 BEGIN {
8 $validate = cpo(
9 new => {
10 id => {
11 type => Str,
12 default => sub {
13 0 ▶ 'http://example.com/root.json'
Subroutine __ANON__: not called CC=1 SCAR=6.9
14 }
15 },
16 title => {
17 type => Str,
18 default => sub {
19 0 ▶ 'The Root Schema'
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 }
21 },
22 description => {
23 type => Str,
24 default => sub {
25 0 ▶ 'The root schema is the schema that comprises the entire JSON document.'
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 }
27 },
28 schema => {
29 type => Str,
30 default => sub {
31 0 ▶ 'http://json-schema.org/draft-07/schema#'
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 }
33 },
34 spec => {
35 type => HashRef,
36 0 ▶ default => sub { { } }
Subroutine __ANON__: not called CC=1 SCAR=6.9
37 },
38 merge_examples => {
39 type => Bool,
40 0 ▶ default => sub { !!0 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 },
42 none_required => {
43 type => Bool,
44 0 ▶ default => sub { !!0 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 },
46 no_id => {
47 type => Bool,
48 0 ▶ default => sub { !!0 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
49 }
50 }
51 5 ▶ );
Subroutine BEGIN: called CC=1 SCAR=0.0
52 5 $JSON = JSON->new->pretty;
53 }
54  
55 sub new {
56 0 ▶ my $class = shift;
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
57 0 my $args = $validate->new->(@_);
58 0 my $self = bless {}, $class;
59 0 $self->{schema} = _tie_hash();
60 0 $self->{schema}{'$schema'} = $args->schema;
61 0 $self->{schema}{'$id'} = $args->id;
62 0 $self->{schema}{title} = $args->title;
63 0 $self->{schema}{description} = $args->description;
64 0 $self->{$_} = $args->$_ for qw/spec merge_examples none_required no_id/;
65 0 ▶ if ($args->merge_examples) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->merge_examples) 0 0 0
66 0 $self->{merge} = Blessed::Merge->new(
67 blessed => 0,
68 unique_array => 1,
69 unique_hash => 1,
70 same => 0
71 );
72 }
73 0 return $self;
74 }
75  
76 sub learn {
77 0 ▶ $_[0]->{data} = ref $_[1] ? $_[1] : $JSON->decode($_[1]);
Subroutine learn: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
ref $_[1] ? : 0 0 0
78 0 $_[0]->{data_runs}++;
79 0 $_[0]->_build_props($_[0]->{schema}, $_[0]->{data}, '#');
80 0 return $_[0];
81 }
82  
83 sub generate {
84 0 ▶ my ($self, $struct) = @_;
Subroutine generate: not called CC=3 SCAR=24.8
Pod documented
85 0 ▶ $self->_handle_required($self->{schema}) unless $self->{none_required};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"none_required"} 0 0 0
86 0 ▶ return $struct ? $self->{schema} : $JSON->encode($self->{schema});
Branch: 1 branch
BranchTrueFalseTotal
$struct ? : 0 0 0
87 }
88  
89 sub _handle_required {
90 0 ▶ my ($self, $schema) = @_;
Subroutine _handle_required: not called CC=7 SCAR=40.3
91 0 my $total_runs = $self->{data_runs};
92 0 ▶ if ($schema->{required}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($schema->{"required"}) 0 0 0
93 0 my @required;
94 0 for my $key (keys %{$schema->{required}}) {
95 0 ▶ if ($schema->{required}->{$key} == $total_runs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($schema->{"required"}{$key} == $total_runs) 0 0 0
96 0 push @required, $key;
97 }
98 }
99 0 $schema->{required} = \@required;
100 }
101 0 ▶ if ($schema->{properties}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($schema->{"properties"}) 0 0 0
102 0 $self->_handle_required($schema->{properties}{$_}) for keys %{$schema->{properties}};
103 }
104 0 ▶ $self->_handle_required($schema->{items}) if $schema->{items};
Branch: 1 branch
BranchTrueFalseTotal
if $schema->{"items"} 0 0 0
105 }
106  
107 sub _build_props {
108 0 ▶ my ($self, $props, $data, $path) = @_;
Subroutine _build_props: not called CC=18 SCAR=58.3
109  
110 0 my $ref = ref $data;
111 0 ▶ if ($ref eq 'HASH') {
Branch: 6 branches
BranchTrueFalseTotal
if ($ref eq 'HASH') { } 0 0 0
elsif ($ref eq 'ARRAY') { } 0 0 0
elsif (not defined $data) { } 0 0 0
elsif ($ref eq 'SCALAR' or $ref =~ /Boolean$/i) { } 0 0 0
elsif ($data =~ /^\d+$/) { } 0 0 0
elsif ($data =~ /^\d+\.\d+$/) { } 0 0 0
112 0 $self->_add_type($props, 'object');
113 0 $self->_unique_examples($props, $data);
114 0 ▶ return if ref $props->{type};
Branch: 1 branch
BranchTrueFalseTotal
if ref $props->{"type"} 0 0 0
115 0 ▶ if (!$props->{properties}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($props->{"properties"}) 0 0 0
116 0 ▶ $props->{required} = {} unless $self->{none_required};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"none_required"} 0 0 0
117 0 $props->{properties} = _tie_hash();
118 }
119 0 for my $key (sort keys %{$data}) {
120 0 ▶ $props->{required}->{$key}++ unless $self->{none_required};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"none_required"} 0 0 0
121 0 my $id = $path . '/properties/' . $key;
122 0 ▶ unless ($props->{properties}{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($props->{"properties"}{$key}) 0 0 0
123 0 $props->{properties}{$key} = _tie_hash();
124 0 %{$props->{properties}{$key}} = (
125 ($self->{no_id} ? () : ('$id' => $id)),
126 title => 'The title',
127 description => 'An explanation about the purpose of this instance',
128 0 ▶ ($self->{spec}->{$key} ? %{$self->{spec}->{$key}} : ())
Branch: 2 branches
BranchTrueFalseTotal
$self->{'no_id'} ? : 0 0 0
$self->{'spec'}{$key} ? : 0 0 0
129 );
130 }
131 0 $self->_build_props($props->{properties}{$key}, $data->{$key}, $id);
132 }
133 } elsif ($ref eq 'ARRAY') {
134 0 $self->_add_type($props, 'array');
135 0 my $id = $path . '/items';
136 0 ▶ unless ($props->{items}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($props->{"items"}) 0 0 0
137 0 $props->{items} = _tie_hash();
138 0 ▶ $props->{items}{'$id'} = $id unless $self->{no_id};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"no_id"} 0 0 0
139 0 $props->{items}{title} = 'The Items Schema';
140 0 $props->{items}{description} = 'An explanation about the purpose of this instance.';
141 }
142 map {
143 0 $self->_build_props($props->{items}, $_, $id);
144 0 } @{$data}
145 } elsif (! defined $data) {
146 0 $self->_add_type($props, 'null');
147 0 $self->_unique_examples($props, undef);
148 ▶ } elsif ($ref eq 'SCALAR' or $ref =~ m/Boolean$/i) {
Condition0%0/3
$ref eq "SCALAR" or $ref =~ /Boolean$/i
l!l&&r!l&&!r
000
MC/DC0%0/2
$ref eq "SCALAR" or $ref =~ /Boolean$/i
$ref eq "SCALAR" $ref =~ /Boolean$/i
Truth table0%0/3
A or B
A= $ref eq "SCALAR"B= $ref =~ /Boolean$/i
ABresult
1X1
011
000
149 0 $self->_add_type($props, 'boolean');
150 0 $self->_unique_examples($props, \1, \0);
151 } elsif ($data =~ m/^\d+$/) {
152 0 $self->_add_type($props, 'integer');
153 0 $self->_unique_examples($props, $data);
154 } elsif ($data =~ m/^\d+\.\d+$/) {
155 0 $self->_add_type($props, 'number');
156 0 $self->_unique_examples($props, $data);
157 # } elsif ($data =~ m/\d{4}\-\d{2}\-\d{2}T\d{2}\:\d{2}\:\d{2}\+\d{2}\:\d{2}/) {
158 # $self->_add_type($props, 'date-time');
159 # $self->_unique_examples($props, $data);
160 } else {
161 0 $self->_add_type($props, 'string');
162 0 $self->_unique_examples($props, $data);
163 }
164  
165 0 return $props;
166 }
167  
168 sub _tie_hash {
169 0 ▶ my %properties;
Subroutine _tie_hash: not called CC=1 SCAR=6.9
170 0 tie %properties, 'Tie::IxHash';
171 0 return \%properties;
172 }
173  
174 sub _add_type {
175 0 ▶ my ($self, $props, $type) = @_;
Subroutine _add_type: not called CC=5 SCAR=34.0
176 0 ▶ if (!$props->{type}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $props->{'type'}) { } 0 0 0
elsif ($props->{'type'} ne $type) { } 0 0 0
177 0 $props->{type} = $type;
178 } elsif ($props->{type} ne $type) {
179 0 ▶ $props->{type} = [ $props->{type} ] unless ref $props->{type};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $props->{"type"} 0 0 0
180 0 ▶ push @{$props->{type}}, $type unless grep { $type eq $_ } @{$props->{type}};
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$type eq $_;} @{$$props{"type"};} 0 0 0
181 }
182 }
183  
184 sub _unique_examples {
185 0 ▶ my ($self, $props, @examples) = @_;
Subroutine _unique_examples: not called CC=9 SCAR=45.0
186 0 for my $example (@examples) {
187 0 ▶ if ((ref($example) || 'SCALAR') ne 'SCALAR' && $props->{examples} && $self->{merge_examples}) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $example || 'SCALAR') ne 'SCALAR' and $props->{'examples'} and $self->{'merge_examples'}) { } 0 0 0
Condition0%0/8
(ref $example || "SCALAR") ne "SCALAR" and $props->{"examples"} and $self->{"merge_examples"}
!ll&&!rl&&r
000
(ref $example || "SCALAR") ne "SCALAR" and $props->{"examples"}
!ll&&!rl&&r
000
ref $example || 'SCALAR'
l!l
00
MC/DC0%0/3
(ref $example || "SCALAR") ne "SCALAR" and $props->{"examples"} and $self->{"merge_examples"}
ref $example $props->{"examples"} $self->{"merge_examples"}
Truth table0%0/4
A and B and C
A= ref $exampleB= $props->{"examples"}C= $self->{"merge_examples"}
ABCresult
0XX0
10X0
1100
1111
188 0 $props->{examples}->[0] = $self->{merge}->merge($props->{examples}->[0], $example);
189 } else {
190 0 ▶ unless (grep { ($_//"") eq ($example//"") } @{$props->{examples}}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {($_ // "") eq ($example // "");} @{$$props{"examples"};}) 0 0 0
Condition0%0/4
$_ // ""
l!l
00
$example // ""
l!l
00
MC/DC0%0/1
$_ // ""
$_
MC/DC0%0/1
$example // ""
$example
Truth table0%0/2
A
A= $_
Aresult
11
00
Truth table0%0/2
A
A= $example
Aresult
11
00
191 0 push @{$props->{examples}}, $example;
192 }
193 }
194 }
195 }
196  
197 5 1;
198  
199 __END__
200  
201 =head1 NAME
202  
203 JSON::Schema::Generate - Generate JSON Schemas from data!
204  
205 =head1 VERSION
206  
207 Version 0.08
208  
209 =cut
210  
211 =head1 SYNOPSIS
212  
213 use JSON::Schema::Generate;
214  
215 my $data = '{
216 "checked": false,
217 "dimensions": {
218 "width": 10,
219 "height": 10
220 },
221 "id": 1,
222 "name": "Opposite",
223 "distance": 435,
224 "tags": [
225 { "date-time": "2020-02-24T10:00:00+00:00" }
226 ]
227 }';
228  
229 my $schema = JSON::Schema::Generate->new(
230 id => 'https://flat.world-wide.world/schema',
231 title => '...'
232 description => '...',
233 spec => {
234 name => {
235 title => '...',
236 description => '...'
237 },
238 ...
239 }
240 )->learn($data)->generate;
241  
242 use JSON::Schema;
243 my $validator = JSON::Schema->new($schema);
244 my $result = $validator->validate($data);
245  
246 ...
247  
248 my $schema = JSON::Schema::Generate->new(
249 no_id => 1
250 )->learn($data)->generate(1);
251  
252 use JSON::Schema::Draft201909;
253  
254 $js = JSON::Schema::Draft201909->new;
255 $result = $js->evaluate_json_string($data, $schema);
256  
257  
258 =head1 DESCRIPTION
259  
260 JSON::Schema::Generate is a tool allowing you to derive JSON Schemas from a set of data.
261  
262 =head1 SUBROUTINES/METHODS
263  
264 =head2 new
265  
266 Instantiate a new JSON::Schema::Generate Object
267  
268 my $schema = JSON::Schema->new(
269 ...
270 );
271  
272 It accepts the following parameters:
273  
274 =over
275  
276 =item id
277  
278 The root $id of the schema. default: http://example.com/root.json
279  
280 =item title
281  
282 The root title of the schema. default: The Root Schema
283  
284 =item description
285  
286 The root description of the schema. default: The root schema is the schema that comprises the entire JSON document.
287  
288 =item schema
289  
290 The root schema version. default: 'http://json-schema.org/draft-07/schema#'
291  
292 =item spec
293  
294 A mapping hash reference that represent a key inside of the passed data and a value that contains additional metadata to be added to the schema. default: {}
295  
296 =item merge_examples
297  
298 Merge all learn data examples into a single example. default: false
299  
300 =item none_required
301  
302 Do not analyse required keys in properties. default: false.
303  
304 =item no_id
305  
306 Do not add $id(s) to properties and items. default: false.
307  
308 =back
309  
310 =head2 learn
311  
312 Accepts a JSON string, Hashref or ArrayRef that it will traverse to build a valid JSON schema. Learn can be chained allowing you to build a schema from multiple data sources.
313  
314 $schema->learn($data1)->learn($data2)->learn($data3);
315  
316 =cut
317  
318 =head2 generate
319  
320 Compiles the learned data and generates the final JSON schema in JSON format.
321  
322 $schema->generate();
323  
324 Optionally you can pass a boolean (true value) which will return the schema as a perl struct.
325  
326 $schema->generate(1)
327  
328 =cut
329  
330 =head1 EXAMPLE
331  
332 use JSON::Schema::Generate;
333  
334 my $data1 = '{
335 "links" : {
336 "cpantesters_reports" : "http://cpantesters.org/author/L/LNATION.html",
337 "cpan_directory" : "http://cpan.org/authors/id/L/LN/LNATION",
338 "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/LNATION",
339 "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=LNATION",
340 "cpants" : "http://cpants.cpanauthors.org/author/LNATION",
341 "backpan_directory" : "https://cpan.metacpan.org/authors/id/L/LN/LNATION"
342 },
343 "city" : "PLUTO",
344 "updated" : "2020-02-16T16:43:51",
345 "region" : "GHANDI",
346 "is_pause_custodial_account" : false,
347 "country" : "WO",
348 "website" : [
349 "https://www.lnation.org"
350 ],
351 "asciiname" : "Robert Acock",
352 "gravatar_url" : "https://secure.gravatar.com/avatar/8e509558181e1d2a0d3a5b55dec0b108?s=130&d=identicon",
353 "pauseid" : "LNATION",
354 "email" : [
355 "lnation@cpan.org"
356 ],
357 "release_count" : {
358 "cpan" : 378,
359 "backpan-only" : 34,
360 "latest" : 114
361 },
362 "name" : "Robert Acock"
363 }';
364  
365 my $data2 = '{
366 "asciiname" : "",
367 "release_count" : {
368 "latest" : 56,
369 "backpan-only" : 358,
370 "cpan" : 190
371 },
372 "name" : "Damian Conway",
373 "email" : "damian@conway.org",
374 "is_pause_custodial_account" : false,
375 "gravatar_url" : "https://secure.gravatar.com/avatar/3d4a6a089964a744d7b3cf2415f81951?s=130&d=identicon",
376 "links" : {
377 "cpants" : "http://cpants.cpanauthors.org/author/DCONWAY",
378 "cpan_directory" : "http://cpan.org/authors/id/D/DC/DCONWAY",
379 "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=DCONWAY",
380 "cpantesters_reports" : "http://cpantesters.org/author/D/DCONWAY.html",
381 "backpan_directory" : "https://cpan.metacpan.org/authors/id/D/DC/DCONWAY",
382 "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/DCONWAY"
383 },
384 "pauseid" : "DCONWAY",
385 "website" : [
386 "http://damian.conway.org/"
387 ]
388 }';
389  
390 my $schema = JSON::Schema::Generate->new(
391 id => 'https://metacpan.org/author.json',
392 title => 'The CPAN Author Schema',
393 description => 'A representation of a cpan author.',
394 )->learn($data1)->learn($data2)->generate;
395  
396 Will generate the following schema:
397
398 {
399 "$schema" : "http://json-schema.org/draft-07/schema#",
400 "$id" : "https://metacpan.org/author.json",
401 "title" : "The CPAN Author Schema",
402 "description" : "A representation of a cpan author.",
403 "type" : "object",
404 "examples" : [
405 {
406 "region" : "GHANDI",
407 "gravatar_url" : "https://secure.gravatar.com/avatar/8e509558181e1d2a0d3a5b55dec0b108?s=130&d=identicon",
408 "is_pause_custodial_account" : false,
409 "asciiname" : "Robert Acock",
410 "release_count" : {
411 "backpan-only" : 34,
412 "latest" : 114,
413 "cpan" : 378
414 },
415 "country" : "WO",
416 "city" : "PLUTO",
417 "pauseid" : "LNATION",
418 "links" : {
419 "cpants" : "http://cpants.cpanauthors.org/author/LNATION",
420 "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/LNATION",
421 "cpantesters_reports" : "http://cpantesters.org/author/L/LNATION.html",
422 "cpan_directory" : "http://cpan.org/authors/id/L/LN/LNATION",
423 "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=LNATION",
424 "backpan_directory" : "https://cpan.metacpan.org/authors/id/L/LN/LNATION"
425 },
426 "updated" : "2020-02-16T16:43:51",
427 "website" : [
428 "https://www.lnation.org"
429 ],
430 "name" : "Robert Acock",
431 "email" : [
432 "lnation@cpan.org"
433 ]
434 },
435 {
436 "is_pause_custodial_account" : false,
437 "gravatar_url" : "https://secure.gravatar.com/avatar/3d4a6a089964a744d7b3cf2415f81951?s=130&d=identicon",
438 "asciiname" : "",
439 "release_count" : {
440 "backpan-only" : 358,
441 "latest" : 56,
442 "cpan" : 190
443 },
444 "links" : {
445 "cpan_directory" : "http://cpan.org/authors/id/D/DC/DCONWAY",
446 "cpantesters_reports" : "http://cpantesters.org/author/D/DCONWAY.html",
447 "cpants" : "http://cpants.cpanauthors.org/author/DCONWAY",
448 "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/DCONWAY",
449 "backpan_directory" : "https://cpan.metacpan.org/authors/id/D/DC/DCONWAY",
450 "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=DCONWAY"
451 },
452 "pauseid" : "DCONWAY",
453 "website" : [
454 "http://damian.conway.org/"
455 ],
456 "email" : "damian@conway.org",
457 "name" : "Damian Conway"
458 }
459 ],
460 "required" : [
461 "asciiname",
462 "gravatar_url",
463 "is_pause_custodial_account",
464 "release_count",
465 "pauseid",
466 "links",
467 "name",
468 "email",
469 "website"
470 ],
471 "properties" : {
472 "asciiname" : {
473 "$id" : "#/properties/asciiname",
474 "title" : "The Asciiname Schema",
475 "description" : "An explanation about the purpose of this instance.",
476 "type" : "string",
477 "examples" : [
478 "Robert Acock",
479 ""
480 ]
481 },
482 "city" : {
483 "$id" : "#/properties/city",
484 "title" : "The City Schema",
485 "description" : "An explanation about the purpose of this instance.",
486 "type" : "string",
487 "examples" : [
488 "PLUTO"
489 ]
490 },
491 "country" : {
492 "$id" : "#/properties/country",
493 "title" : "The Country Schema",
494 "description" : "An explanation about the purpose of this instance.",
495 "type" : "string",
496 "examples" : [
497 "WO"
498 ]
499 },
500 "email" : {
501 "$id" : "#/properties/email",
502 "title" : "The Email Schema",
503 "description" : "An explanation about the purpose of this instance.",
504 "type" : [
505 "array",
506 "string"
507 ],
508 "items" : {
509 "$id" : "#/properties/email/items",
510 "title" : "The Items Schema",
511 "description" : "An explanation about the purpose of this instance.",
512 "type" : "string",
513 "examples" : [
514 "lnation@cpan.org"
515 ]
516 },
517 "examples" : [
518 "damian@conway.org"
519 ]
520 },
521 "gravatar_url" : {
522 "$id" : "#/properties/gravatar_url",
523 "title" : "The Gravatar_url Schema",
524 "description" : "An explanation about the purpose of this instance.",
525 "type" : "string",
526 "examples" : [
527 "https://secure.gravatar.com/avatar/8e509558181e1d2a0d3a5b55dec0b108?s=130&d=identicon",
528 "https://secure.gravatar.com/avatar/3d4a6a089964a744d7b3cf2415f81951?s=130&d=identicon"
529 ]
530 },
531 "is_pause_custodial_account" : {
532 "$id" : "#/properties/is_pause_custodial_account",
533 "title" : "The Is_pause_custodial_account Schema",
534 "description" : "An explanation about the purpose of this instance.",
535 "type" : "boolean",
536 "examples" : [
537 true,
538 false
539 ]
540 },
541 "links" : {
542 "$id" : "#/properties/links",
543 "title" : "The Links Schema",
544 "description" : "An explanation about the purpose of this instance.",
545 "type" : "object",
546 "examples" : [
547 {
548 "cpants" : "http://cpants.cpanauthors.org/author/LNATION",
549 "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/LNATION",
550 "cpantesters_reports" : "http://cpantesters.org/author/L/LNATION.html",
551 "cpan_directory" : "http://cpan.org/authors/id/L/LN/LNATION",
552 "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=LNATION",
553 "backpan_directory" : "https://cpan.metacpan.org/authors/id/L/LN/LNATION"
554 },
555 {
556 "cpan_directory" : "http://cpan.org/authors/id/D/DC/DCONWAY",
557 "cpantesters_reports" : "http://cpantesters.org/author/D/DCONWAY.html",
558 "cpants" : "http://cpants.cpanauthors.org/author/DCONWAY",
559 "metacpan_explorer" : "https://explorer.metacpan.org/?url=/author/DCONWAY",
560 "backpan_directory" : "https://cpan.metacpan.org/authors/id/D/DC/DCONWAY",
561 "cpantesters_matrix" : "http://matrix.cpantesters.org/?author=DCONWAY"
562 }
563 ],
564 "required" : [
565 "cpantesters_matrix",
566 "backpan_directory",
567 "metacpan_explorer",
568 "cpants",
569 "cpantesters_reports",
570 "cpan_directory"
571 ],
572 "properties" : {
573 "backpan_directory" : {
574 "$id" : "#/properties/links/properties/backpan_directory",
575 "title" : "The Backpan_directory Schema",
576 "description" : "An explanation about the purpose of this instance.",
577 "type" : "string",
578 "examples" : [
579 "https://cpan.metacpan.org/authors/id/L/LN/LNATION",
580 "https://cpan.metacpan.org/authors/id/D/DC/DCONWAY"
581 ]
582 },
583 "cpan_directory" : {
584 "$id" : "#/properties/links/properties/cpan_directory",
585 "title" : "The Cpan_directory Schema",
586 "description" : "An explanation about the purpose of this instance.",
587 "type" : "string",
588 "examples" : [
589 "http://cpan.org/authors/id/L/LN/LNATION",
590 "http://cpan.org/authors/id/D/DC/DCONWAY"
591 ]
592 },
593 "cpantesters_matrix" : {
594 "$id" : "#/properties/links/properties/cpantesters_matrix",
595 "title" : "The Cpantesters_matrix Schema",
596 "description" : "An explanation about the purpose of this instance.",
597 "type" : "string",
598 "examples" : [
599 "http://matrix.cpantesters.org/?author=LNATION",
600 "http://matrix.cpantesters.org/?author=DCONWAY"
601 ]
602 },
603 "cpantesters_reports" : {
604 "$id" : "#/properties/links/properties/cpantesters_reports",
605 "title" : "The Cpantesters_reports Schema",
606 "description" : "An explanation about the purpose of this instance.",
607 "type" : "string",
608 "examples" : [
609 "http://cpantesters.org/author/L/LNATION.html",
610 "http://cpantesters.org/author/D/DCONWAY.html"
611 ]
612 },
613 "cpants" : {
614 "$id" : "#/properties/links/properties/cpants",
615 "title" : "The Cpants Schema",
616 "description" : "An explanation about the purpose of this instance.",
617 "type" : "string",
618 "examples" : [
619 "http://cpants.cpanauthors.org/author/LNATION",
620 "http://cpants.cpanauthors.org/author/DCONWAY"
621 ]
622 },
623 "metacpan_explorer" : {
624 "$id" : "#/properties/links/properties/metacpan_explorer",
625 "title" : "The Metacpan_explorer Schema",
626 "description" : "An explanation about the purpose of this instance.",
627 "type" : "string",
628 "examples" : [
629 "https://explorer.metacpan.org/?url=/author/LNATION",
630 "https://explorer.metacpan.org/?url=/author/DCONWAY"
631 ]
632 }
633 }
634 },
635 "name" : {
636 "$id" : "#/properties/name",
637 "title" : "The Name Schema",
638 "description" : "An explanation about the purpose of this instance.",
639 "type" : "string",
640 "examples" : [
641 "Robert Acock",
642 "Damian Conway"
643 ]
644 },
645 "pauseid" : {
646 "$id" : "#/properties/pauseid",
647 "title" : "The Pauseid Schema",
648 "description" : "An explanation about the purpose of this instance.",
649 "type" : "string",
650 "examples" : [
651 "LNATION",
652 "DCONWAY"
653 ]
654 },
655 "region" : {
656 "$id" : "#/properties/region",
657 "title" : "The Region Schema",
658 "description" : "An explanation about the purpose of this instance.",
659 "type" : "string",
660 "examples" : [
661 "GHANDI"
662 ]
663 },
664 "release_count" : {
665 "$id" : "#/properties/release_count",
666 "title" : "The Release_count Schema",
667 "description" : "An explanation about the purpose of this instance.",
668 "type" : "object",
669 "examples" : [
670 {
671 "backpan-only" : 34,
672 "latest" : 114,
673 "cpan" : 378
674 },
675 {
676 "backpan-only" : 358,
677 "latest" : 56,
678 "cpan" : 190
679 }
680 ],
681 "required" : [
682 "latest",
683 "backpan-only",
684 "cpan"
685 ],
686 "properties" : {
687 "backpan-only" : {
688 "$id" : "#/properties/release_count/properties/backpan-only",
689 "title" : "The Backpan-only Schema",
690 "description" : "An explanation about the purpose of this instance.",
691 "type" : "integer",
692 "examples" : [
693 34,
694 358
695 ]
696 },
697 "cpan" : {
698 "$id" : "#/properties/release_count/properties/cpan",
699 "title" : "The Cpan Schema",
700 "description" : "An explanation about the purpose of this instance.",
701 "type" : "integer",
702 "examples" : [
703 378,
704 190
705 ]
706 },
707 "latest" : {
708 "$id" : "#/properties/release_count/properties/latest",
709 "title" : "The Latest Schema",
710 "description" : "An explanation about the purpose of this instance.",
711 "type" : "integer",
712 "examples" : [
713 114,
714 56
715 ]
716 }
717 }
718 },
719 "updated" : {
720 "$id" : "#/properties/updated",
721 "title" : "The Updated Schema",
722 "description" : "An explanation about the purpose of this instance.",
723 "type" : "string",
724 "examples" : [
725 "2020-02-16T16:43:51"
726 ]
727 },
728 "website" : {
729 "$id" : "#/properties/website",
730 "title" : "The Website Schema",
731 "description" : "An explanation about the purpose of this instance.",
732 "type" : "array",
733 "items" : {
734 "$id" : "#/properties/website/items",
735 "title" : "The Items Schema",
736 "description" : "An explanation about the purpose of this instance.",
737 "type" : "string",
738 "examples" : [
739 "https://www.lnation.org",
740 "http://damian.conway.org/"
741 ]
742 }
743 }
744 }
745 }
746  
747 =head1 AUTHOR
748  
749 LNATION, C<< <email at lnation.org> >>
750  
751 =head1 BUGS
752  
753 Please report any bugs or feature requests to C<bug-json-schema-generate at rt.cpan.org>, or through
754 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-Schema-Generate>. I will be notified, and then you'll
755 automatically be notified of progress on your bug as I make changes.
756  
757 =head1 SUPPORT
758  
759 You can find documentation for this module with the perldoc command.
760  
761 perldoc JSON::Schema::Generate
762  
763 You can also look for information at:
764  
765 =over 4
766  
767 =item * RT: CPAN's request tracker (report bugs here)
768  
769 L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=JSON-Schema-Generate>
770  
771 =item * AnnoCPAN: Annotated CPAN documentation
772  
773 L<http://annocpan.org/dist/JSON-Schema-Generate>
774  
775 =item * CPAN Ratings
776  
777 L<https://cpanratings.perl.org/d/JSON-Schema-Generate>
778  
779 =item * Search CPAN
780  
781 L<https://metacpan.org/release/JSON-Schema-Generate>
782  
783 =back
784  
785 =head1 ACKNOWLEDGEMENTS
786  
787 =head1 LICENSE AND COPYRIGHT
788  
789 This software is Copyright (c) 2020->2021 by LNATION.
790  
791 This is free software, licensed under:
792  
793 The Artistic License 2.0 (GPL Compatible)
794  
795 =cut
796  
797 1; # End of JSON::Schema::Generate
↑ Summary