asdf.schema
¶
Functions:
| Name | Description |
|---|---|
check_schema |
Check a given schema to make sure it is valid YAML schema. |
fill_defaults |
For any default values in the schema, add them to the tree if they |
load_schema |
Load a schema from the given URL. |
remove_defaults |
For any values in the tree that are the same as the default values |
validate |
Validate the given instance (which must be a tagged tree) against |
check_schema
¶
Check a given schema to make sure it is valid YAML schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
dict
|
The schema object, as returned by |
required |
validate_default
|
bool
|
Set to |
True
|
Source code in asdf/schema.py
fill_defaults
¶
For any default values in the schema, add them to the tree if they don’t exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
tagged tree
|
|
required |
ctx
|
AsdfFile context
|
Used to resolve tags and urls |
required |
reading
|
Indicates whether the ASDF file is being read (in contrast to being written). |
False
|
Source code in asdf/schema.py
load_schema
¶
Load a schema from the given URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The path to the schema |
required |
resolve_references
|
bool
|
If |
False
|
Source code in asdf/schema.py
remove_defaults
¶
For any values in the tree that are the same as the default values specified in the schema, remove them from the tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
tagged tree
|
|
required |
ctx
|
AsdfFile context
|
Used to resolve tags and urls |
required |
Source code in asdf/schema.py
validate
¶
Validate the given instance (which must be a tagged tree) against the appropriate schema. The schema itself is located using the tag on the instance.
The additional *args and **kwargs are passed along to
the validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance
|
tagged tree
|
|
required |
ctx
|
AsdfFile context
|
Used to resolve tags and urls |
None
|
schema
|
schema
|
Explicit schema to use. If not provided, the schema to use
is determined by the tag on instance (or subinstance) and
any custom schema provided to |
None
|
validators
|
dict
|
A dictionary mapping properties to validators to use (instead of the built-in ones and ones provided by extension types). |
None
|
reading
|
Indicates whether validation is being performed when the file is being read. This is useful to allow for different validation behavior when reading vs writing files. |
False
|