silk.json.schema_metas.
Offline official JSON Schema meta-schemas for drafts 4, 6, 7, 2019-09, and 2020-12.
When to use#
Use SchemaMetas.documents to supply the official meta-schema resources when compiling
schemas that reference them. Add borrowed views of the returned documents to the resource
registry passed to silk.json.schema.Schema.compile; keep the documents alive while the
compiled schema is used. No network requests are made.
Import as SchemaMetas with import silk.json.schema_metas { SchemaMetas }.
Public declarations: 2.
MetaDocument#
pub struct MetaDocumentAn owned official meta-schema and its canonical retrieval URI.
Field uri#
pub uri: StringCanonical resource URI, without an empty fragment.
Field schema#
pub schema: ValueExact JSON data model of the official meta-schema.
SchemaMetas#
pub struct SchemaMetasConstructs the offline official meta-schema resource collection.
Implementation SchemaMetas#
impl SchemaMetasAssociated function documents#
pub effect fn documents() -> List<MetaDocument>
! JsonError | OutOfMemoryError ? &mut AllocatorParses the embedded official meta-schemas for drafts 4, 6, 7, 2019-09, and 2020-12.
Details#
The returned collection owns its trees. Pass borrowed Resource views to Schema.compile
and retain this collection for the lifetime of compiled schemas. It includes the individual
vocabulary meta-schemas, including the optional 2020-12 format-assertion vocabulary.
Nothing is downloaded and no schemas are read from the filesystem.
Errors#
OutOfMemoryErrorif the allocator cannot supply the collection or parsed trees.JsonErrorif an embedded document cannot be parsed.
Category: Data formats.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2, x86_64-pc-windows-msvc, wasm64-unknown-unknown.