Vendored core schemas from asdf-standard 1.5.0, commit daff9d5.
The files are YAML Schema draft-01. tag, propertyOrder, flowStyle,
style, and examples are removed. What remains is checked with the
JSON Schema draft-04 vocabulary. The core manifest whose
asdf_standard_requirement is 1.5.0 is core-1.5.0. Manifest core-1.6.0
in the same commit requires standard 1.6.0 and is not the conformance
target. core-1.7.0 is under resources/unstable and is not vendored.
ndarray-1.1.0 and integer-1.1.0 are vendored because this commit
already contains them and the reader accepts those tags. Their schemas
reference themselves. resolve/1 reports reason: :cyclic_ref and
validate_tree/2 does not treat that as a successful schema check.
Summary
Functions
Returns relative refs that pointed outside the vendored set, sorted.
Returns the ids of the vendored schemas, sorted.
Follows $ref in one vendored schema.
Checks known tags in tree.
Functions
@spec exclusions() :: [String.t()]
Returns relative refs that pointed outside the vendored set, sorted.
These are the unit, time, FITS, and WCS refs replaced while the catalog was loaded. Does not raise.
Examples
iex> Enum.any?(ASDF.Schema.exclusions(), &String.contains?(&1, "/unit/"))
true
@spec ids() :: [String.t()]
Returns the ids of the vendored schemas, sorted.
Each id is an http://stsci.edu/schemas/asdf/ URI. Does not raise.
Examples
iex> "http://stsci.edu/schemas/asdf/core/asdf-1.1.0" in ASDF.Schema.ids()
true
@spec resolve(String.t()) :: :ok | {:error, ASDF.Error.t()}
Follows $ref in one vendored schema.
id is a schema URI from ids/0. Returns :ok when every local ref
stays inside the vendored set and no id is entered twice.
Returns {:error, %ASDF.Error{}}. reason: :cyclic_ref means the schema
references itself, which is true of ndarray-1.0.0, ndarray-1.1.0,
integer-1.0.0, integer-1.1.0, and datatype-1.0.0.
reason: :unresolved_tag means id is not vendored.
reason: :remote_ref means a ref leaves the set. Does not fetch.
Does not raise.
Examples
iex> ASDF.Schema.resolve("http://stsci.edu/schemas/asdf/core/software-1.0.0")
:ok
iex> {:error, error} = ASDF.Schema.resolve("http://stsci.edu/schemas/asdf/core/ndarray-1.0.0")
...> error.reason
:cyclic_ref
iex> {:error, error} = ASDF.Schema.resolve("http://example.test/missing")
...> error.reason
:unresolved_tag
@spec validate_tree(term(), :strict | :permissive) :: {:ok, [ASDF.Warning.t()]} | {:error, ASDF.Error.t()}
Checks known tags in tree.
tree is a YAML value, often an %ASDF.Tagged{}. mode is :strict or
:permissive. Returns {:ok, warnings}. Unknown tags are
{:error, %ASDF.Error{reason: :unresolved_tag}} in :strict mode and one
warning in :permissive mode. A value that fails its schema is
reason: :schema_mismatch. A cyclic vendored schema is recorded as a
warning and is not treated as a successful check. The tagged value is not
replaced. Does not raise.
Examples
iex> tag = "tag:stsci.edu:asdf/core/software-1.0.0"
...> tree = %ASDF.Tagged{tag: tag, value: %{"name" => "demo", "version" => "1"}}
...> ASDF.Schema.validate_tree(tree, :strict)
{:ok, []}
iex> tree = %ASDF.Tagged{tag: "tag:example:nope", value: 1}
...> {:error, error} = ASDF.Schema.validate_tree(tree, :strict)
...> error.reason
:unresolved_tag