silk.json.schema_format.
String format assertions for JSON Schema, without network access.
SchemaFormat.check checks the standard format names and accepts unknown names. Schema
evaluation must opt in to assertions: a format annotation alone does not reject an instance.
Import as SchemaFormat with import silk.json.schema_format { SchemaFormat }.
Public declarations: 1.
SchemaFormat#
pub struct SchemaFormatChecks the standard JSON Schema string formats. No check performs DNS or network access.
Implementation SchemaFormat#
impl SchemaFormatAssociated function known#
pub fn known(name: string) -> boolReturns whether name is a standard format implemented by this module.
Associated function check#
pub effect fn check(name: string, value: string) -> bool ! RegexError | OutOfMemoryError ? &mut AllocatorReturns whether value satisfies name; an unknown format name returns true.
Details#
Dates and times use RFC 3339, durations its Appendix A, mailboxes RFC 5321 and RFC 6531, URI references RFC 3986, IRIs RFC 3987, and URI templates RFC 6570. International hostnames use nontransitional UTS #46 mapping and IDNA2008 contextual and bidirectional checks. Regex syntax uses ECMAScript Unicode mode. The function does not resolve names or references.
Errors#
OutOfMemoryErrorif temporary Unicode or regular-expression storage cannot be allocated.RegexErrorif a regular expression exceeds the parser's resource limits. Invalid syntax returnsfalse; operational failures are not treated as invalid instances.
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.