Schema/sah/nschema.pm

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 6 / 6 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Schema/sah/nondefhash_example.pm ↑ Summary Schema/sah/schema.pm »
1 package Sah::Schema::sah::nschema;
2  
3 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4 1 our $DATE = '2021-07-23'; # DATE
5 1 our $DIST = 'Sah-Schemas-Sah'; # DIST
6 1 our $VERSION = '0.9.50.0'; # VERSION
7  
8 1 our $schema = ['array' => {
9 summary => 'Normalized Sah schema',
10 min_len => 2,
11 max_len => 2,
12 elems => [
13 ['sah::type_name', {req=>1}],
14 ['sah::clause_set', {}],
15 ],
16 # XXX: check that all schemas specified in clauses are also normalized, e.g.
17 # 'of' and 'elems' clause in 'array', etc.
18  
19 examples => [
20 {value=>'int', valid=>0, summary=>'Not array'},
21 {value=>'int*', valid=>0, summary=>'Not array'},
22 {value=>[], valid=>0, summary=>'Lacks type name and clause set'},
23 {value=>['int'], valid=>0, summary=>'Lacks clause set'},
24 {value=>['int', {}], valid=>1},
25 {value=>['int', {min=>1, max=>1}], valid=>1},
26 {value=>['int', {}, {}], valid=>0, summary=>'This schema no longer accepts extras'},
27 ],
28  
29 }];
30  
31 1 1;
32 # ABSTRACT: Sah schema (normalized form)
33  
34 __END__
« Schema/sah/nondefhash_example.pm ↑ Summary Schema/sah/schema.pm »