| 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__ |