pub struct CompileOptions {
pub default_dialect: Dialect,
pub assert_format: Option<bool>,
pub assert_format_in_legacy_drafts: bool,
pub assert_content: bool,
pub formats: HashMap<String, FormatValidator>,
pub resolve_document: Option<DocumentResolver>,
pub base_uri: Option<String>,
pub entry_point: Option<String>,
pub max_depth: u32,
pub pattern_match_limit: Option<Duration>,
}Expand description
Options for compiling a schema.
Fields§
§default_dialect: DialectThe dialect for documents without $schema. Defaults to 2020-12.
assert_format: Option<bool>Whether format is asserted. None (the default) follows the vocabularies: the 2020-12 format-assertion
vocabulary asserts, everything else annotates.
assert_format_in_legacy_drafts: boolWhen assert_format is None, assert format in draft 4 to 7 too.
assert_content: boolAssert contentEncoding/contentMediaType in draft 7 (the only draft that asserts them). Defaults to true.
formats: HashMap<String, FormatValidator>Custom format assertions, by format name; they take precedence over the built-in set.
resolve_document: Option<DocumentResolver>Resolves remote documents. The standard metaschemas are always available.
base_uri: Option<String>The base URI of the root document.
entry_point: Option<String>A reference (relative to the root) to evaluate from, e.g. #/$defs/item. Defaults to the root.
max_depth: u32Maximum depth of in-place recursion on a cycle before evaluation is abandoned. Defaults to 128.
pattern_match_limit: Option<Duration>The time one match of a pattern or patternProperties regular expression against one string may take.
Defaults to DEFAULT_PATTERN_MATCH_LIMIT, one second. A match that takes longer is abandoned, and the
validation it belongs to reports a PatternMatchLimitError. None, or a limit of zero, turns the limit
off, for a caller who trusts both the schema and the instances. Without the limit a match also has no limit
on its memory.
The limit is on each match, not on the validation. Only the backtracking matcher can take long, and it reads the clock every 4,096 steps, so a match is abandoned within tens of microseconds of the limit. The matchers that take time proportional to the string are not stopped: a string is given to one only when it can answer within the limit.