SYNOPSIS
use Data::Sah::Resolve qw(resolve_schema);
my $sch = resolve_schema("int");
# => ["int", []]
my $sch = resolve_schema("posint*");
# => ["int", [{min=>1}, {req=>1}]
my $sch = resolve_schema([posint => div_by => 3]);
# => ["int", {min=>1}, {div_by=>3}]
my $sch = resolve_schema(["posint", "merge.delete.min"=>undef, div_by => 3]);
# => ["int", {div_by=>3}]
DESCRIPTION
FUNCTIONS
resolve_schema([ \%opts, ] $sch) => sch
Sah schemas can be defined in terms of other schema. The resolving
process follows the base schema recursively until it finds a builtin
type as the base.
This routine: 1) normalizes the schema (unless schema_is_normalized
option is true, in which case schema is assumed to be normalized
already); 2) checks schema's type to see if it's the name of another
schema (searched in Sah::Schema::<name> module); 3) if schema's type is
another schema then retrieve the base schema and repeat the process
while accumulating/ and/or merging the clause sets; 4) if schema's type
is a known builtin type, stop; 5) if schema's type is neither, die.
Returns [base_type, clause_sets]. If return_intermediates option is
true, then the third elements will be the list of intermediate schema
names.
Known options:
* schema_is_normalized => bool (default: 0)
When set to true, function will skip normalizing schema and assume
input schema is normalized.
* merge_clause_sets => bool (default: 1)
* return_intermediates => bool
SEE ALSO
Sah, Data::Sah