Debian Codegraph @

src/keywords/unevaluated_properties.rs

raw symbols SCIP
1 //! Implementation of the `unevaluatedProperties` keyword.
2 //!
3 //! This keyword validates properties that were not evaluated by other keywords like
4 //! `properties`, `additionalProperties`, `patternProperties`, or nested schemas in
5 //! combinators (`allOf`, `anyOf`, `oneOf`), conditionals, and references.
6 //!
7 //! The implementation eagerly compiles a recursive `PropertyValidators` structure during
8 //! schema compilation, using `Shared<OnceLock>` for circular reference handling.
9 use ahashrust-analyzer cargo ahash 0.8.12 crate/::AHashSetrust-analyzer cargo ahash 0.8.12 hash_set/AHashSet#;
10 use fancy_regexrust-analyzer cargo fancy-regex 0.11.0 crate/::Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#;
11 use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::{Maprust-analyzer cargo serde_json 1.0.145 map/Map#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#};
12 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#;
13
14 use craterust-analyzer cargo jsonschema 0.37.4 crate/::{
15 compilerrust-analyzer cargo jsonschema 0.37.4 compiler/, ecmarust-analyzer cargo jsonschema 0.37.4 ecma/,
16 evaluationrust-analyzer cargo jsonschema 0.37.4 evaluation/::ErrorDescriptionrust-analyzer cargo jsonschema 0.37.4 evaluation/ErrorDescription#,
17 noderust-analyzer cargo jsonschema 0.37.4 node/::SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#,
18 pathsrust-analyzer cargo jsonschema 0.37.4 paths/::{LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#},
19 threadrust-analyzer cargo jsonschema 0.37.4 thread/::Sharedrust-analyzer cargo jsonschema 0.37.4 thread/Shared#,
20 validatorrust-analyzer cargo jsonschema 0.37.4 validator/::{EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#, Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate#, ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#},
21 ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#,
22 };
23
24 use superrust-analyzer cargo jsonschema 0.37.4 keywords/::CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#;
25
26 /// Lazy property validators that are compiled on first access.
27 /// Used for $recursiveRef and circular references to handle cycles during compilation.
28 pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) type PendingPropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PendingPropertyValidators# = Sharedrust-analyzer cargo jsonschema 0.37.4 thread/Shared#<OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#>>;
29
30 /// Holds compiled validators for property evaluation in unevaluatedProperties.
31 /// This structure is built during schema compilation and used during validation.
32 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
33 pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators# {
34 /// Direct property validators from "properties" keyword
35 propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#properties.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>,
36 /// Validator from "additionalProperties" keyword
37 additionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#additional.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#>,
38 /// Pattern-based property validators from "patternProperties" keyword
39 pattern_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#pattern_properties.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>,
40 /// Validator from "unevaluatedProperties" keyword itself
41 unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#unevaluated.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#>,
42 /// Validators from "allOf" keyword - both the schema and its property validators
43 all_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#all_of.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>,
44 /// Validators from "anyOf" keyword
45 any_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#any_of.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>,
46 /// Validators from "oneOf" keyword
47 one_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#one_of.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>,
48 /// Conditional validators from "if/then/else" keywords
49 conditionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#conditional.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ConditionalValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#>>,
50 /// Reference validators from "$ref" keyword (may be circular)
51 ref_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#ref_.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<RefValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/RefValidator#>,
52 /// Reference validators from "$dynamicRef" keyword
53 dynamic_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#dynamic_ref.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#>>,
54 /// Validators from "$recursiveRef" keyword (Draft 2019-09 only)
55 /// Uses pending pattern to handle circular references
56 recursive_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#recursive_ref.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PendingPropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PendingPropertyValidators#>,
57 /// Dependent schema validators from "dependentSchemas" keyword
58 dependentrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#dependent.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>,
59 }
60
61 /// Reference validator - just wraps `PropertyValidators`
62 /// Circular references are handled by returning None during compilation
63 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
64 struct RefValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/RefValidator#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#>);
65
66 /// Conditional validators from "if/then/else" keywords
67 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
68 struct ConditionalValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators# {
69 conditionrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#condition.: SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#,
70 if_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#if_.: PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#,
71 then_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#then_.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#>,
72 else_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#else_.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#>,
73 }
74
75 impl PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators# {
76 /// Mark all properties that are evaluated by this schema.
77 /// This is the core logic for determining which properties should not be considered "unevaluated".
78 fn mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().<'i>(
79 &self,
80 instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#,
81 properties: &mut AHashSetrust-analyzer cargo ahash 0.8.12 hash_set/AHashSet#<&'i Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
82 ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#,
83 ) {
84 // Handle $ref first
85 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref_) = &self.ref_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#ref_. {
86 ref_.0rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/RefValidator#0..mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
87 }
88
89 // Handle $recursiveRef (Draft 2019-09 only)
90 // Skip if not yet initialized (circular reference) - properties will be tracked by parent
91 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(recursive_ref) = &self.recursive_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#recursive_ref. {
92 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(validators) = recursive_ref.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]get().() {
93 validators.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
94 }
95 }
96
97 // Handle $dynamicRef (Draft 2020-12+)
98 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dynamic_ref) = &self.dynamic_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#dynamic_ref. {
99 dynamic_ref.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
100 }
101
102 // Process properties on the instance
103 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(obj) = instance {
104 // Mark properties from "properties" keyword
105 for property in obj.keysrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]keys().() {
106 if self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#properties..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|(p, _)| p rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().property) {
107 properties.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(property);
108 }
109 }
110
111 // Check "patternProperties" keyword - mark if property name matches
112 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.pattern_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#pattern_properties..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
113 for property in obj.keysrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]keys().() {
114 if properties.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(property) {
115 continue; // Already marked by "properties"
116 }
117 for (pattern, _) in &self.pattern_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#pattern_properties. {
118 if pattern.is_matchrust-analyzer cargo fancy-regex 0.11.0 impl#[Regex]is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) {
119 properties.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(property);
120 break;
121 }
122 }
123 }
124 }
125
126 // Check "additionalProperties" keyword - applies to properties NOT in properties/patternProperties
127 // This must be done after marking all properties/patternProperties to avoid order dependency
128 if self.additionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#additional..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
129 for property in obj.keysrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]keys().() {
130 // Only mark if not already marked by properties or patternProperties
131 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().properties.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(property) {
132 properties.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(property);
133 }
134 }
135 }
136
137 // Check "unevaluatedProperties" keyword - marks properties that validate successfully
138 // This is crucial for nested unevaluatedProperties: a child schema's unevaluatedProperties
139 // can mark properties as evaluated for parent schemas
140 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(unevaluated) = &self.unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#unevaluated. {
141 for (property, value) in obj {
142 // Skip if already marked - avoid redundant validation
143 if properties.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(property) {
144 continue;
145 }
146 if unevaluated.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) {
147 properties.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(property);
148 }
149 }
150 }
151
152 // Check "dependentSchemas" keyword
153 for (dep_property, dep_validators) in &self.dependentrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#dependent. {
154 if obj.contains_keyrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]contains_key().(dep_property) {
155 dep_validators.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
156 }
157 }
158 }
159
160 // Handle "if/then/else" keywords
161 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(conditional) = &self.conditionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#conditional. {
162 conditional.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[ConditionalValidators]mark_evaluated_properties().(instance, properties, ctx);
163 }
164
165 // Handle "allOf" keyword
166 for (node, validators) in &self.all_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#all_of. {
167 if node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(instance, ctx) {
168 validators.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
169 }
170 }
171
172 // Handle "anyOf" keyword
173 for (node, validators) in &self.any_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#any_of. {
174 if node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(instance, ctx) {
175 validators.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
176 }
177 }
178
179 // Handle "oneOf" keyword - only if exactly one matches
180 let one_of_matches: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<bool> = self
181 .one_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#one_of.
182 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
183 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(node, _)| node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(instance, ctx))
184 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
185
186 if one_of_matches.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&&v| v).countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]count().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 {
187 for ((_node, validators), &is_valid) in self.one_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#one_of..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(one_of_matches.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
188 if is_valid {
189 validators.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
190 break;
191 }
192 }
193 }
194 }
195 }
196
197 impl ConditionalValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators# {
198 fn mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[ConditionalValidators]mark_evaluated_properties().<'i>(
199 &self,
200 instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#,
201 properties: &mut AHashSetrust-analyzer cargo ahash 0.8.12 hash_set/AHashSet#<&'i Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
202 ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#,
203 ) {
204 if self.conditionrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#condition..is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(instance, ctx) {
205 self.if_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#if_.
206 .mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
207 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(then_) = &self.then_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#then_. {
208 then_.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
209 }
210 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(else_) = &self.else_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#else_. {
211 else_.mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, properties, ctx);
212 }
213 }
214 }
215
216 /// Compile all property validators for a schema.
217 ///
218 /// Recursively builds the `PropertyValidators` tree by examining all keywords that
219 /// can evaluate properties. Handles circular references via pending nodes cached
220 /// by location and schema pointer.
221 fn compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().<'a>(
222 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
223 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
224 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
225 // Create a pending node and cache it before compiling to handle circular refs
226 let cache_key = ctx.location_cache_keyrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location_cache_key().();
227 let pending = Sharedrust-analyzer cargo jsonschema 0.37.4 thread/Shared#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]new().());
228 ctx.cache_pending_property_validatorsrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]cache_pending_property_validators().(cache_key.clonerust-analyzer cargo jsonschema 0.37.4 compiler/impl#[LocationCacheKey][Clone]clone().(), pending.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().());
229 ctx.cache_pending_property_validators_for_schemarust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]cache_pending_property_validators_for_schema().(parent, pending.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().());
230
231 // Compile all parts
232 let validators = PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators# {
233 propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#properties.: compile_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_properties().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
234 additionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#additional.: compile_additionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_additional().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
235 pattern_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#pattern_properties.: compile_pattern_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_pattern_properties().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
236 unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#unevaluated.: compile_unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_unevaluated().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
237 all_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#all_of.: compile_all_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_all_of().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
238 any_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#any_of.: compile_any_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_any_of().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
239 one_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#one_of.: compile_one_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_one_of().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
240 conditionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#conditional.: compile_conditionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_conditional().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
241 ref_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#ref_.: compile_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_ref().(ctx, parent).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
242 dynamic_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#dynamic_ref.: compile_dynamic_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_dynamic_ref().(ctx, parent).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
243 recursive_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#recursive_ref.: compile_recursive_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_recursive_ref().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
244 dependentrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#dependent.: compile_dependentrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_dependent().(ctx, parent)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
245 };
246
247 // Initialize the pending node. This should always succeed since we just created it.
248 pending
249 .setrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]set().(validators.clonerust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators][Clone]clone().())
250 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("pending node should not be initialized yet");
251
252 // Remove from pending cache
253 ctx.remove_pending_property_validatorsrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]remove_pending_property_validators().(&cache_key);
254 ctx.remove_pending_property_validators_for_schemarust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]remove_pending_property_validators_for_schema().(parent);
255
256 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(validators)
257 }
258
259 fn compile_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_properties().<'a>(
260 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
261 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
262 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
263 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("properties") else {
264 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().());
265 };
266
267 let properties_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("properties");
268 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(map.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().());
269
270 for (property, subschema) in map {
271 let prop_ctx = properties_ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().());
272 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&prop_ctx, prop_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))
273 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
274 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), node));
275 }
276
277 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
278 }
279
280 fn compile_additionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_additional().<'a>(
281 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
282 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
283 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
284 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(subschema) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("additionalProperties") else {
285 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
286 };
287
288 let additional_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties");
289 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&additional_ctx, additional_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))
290 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
291 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(node))
292 }
293
294 fn compile_pattern_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_pattern_properties().<'a>(
295 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
296 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
297 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
298 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(patterns)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("patternProperties") else {
299 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().());
300 };
301
302 let pat_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties");
303 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(patterns.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().());
304
305 for (pattern, schema) in patterns {
306 let schema_ctx = pat_ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(pattern.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().());
307 let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(regex) = ecmarust-analyzer cargo jsonschema 0.37.4 ecma/::to_rust_regexrust-analyzer cargo jsonschema 0.37.4 ecma/to_rust_regex().(pattern).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then().(|p| Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#::newrust-analyzer cargo fancy-regex 0.11.0 impl#[Regex]new().(&p).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| ()))
308 else {
309 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::formatrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]format().(
310 Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(),
311 ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(),
312 schema,
313 "regex",
314 ));
315 };
316 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&schema_ctx, schema_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema))
317 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
318 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((regex, node));
319 }
320
321 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
322 }
323
324 fn compile_unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_unevaluated().<'a>(
325 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
326 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
327 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
328 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(subschema) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("unevaluatedProperties") else {
329 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
330 };
331
332 let unevaluated_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("unevaluatedProperties");
333 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&unevaluated_ctx, unevaluated_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))
334 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
335 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(node))
336 }
337
338 fn compile_all_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_all_of().<'a>(
339 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
340 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
341 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
342 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(subschemas)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("allOf").maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::as_arrayrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_array().) else {
343 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().());
344 };
345
346 let all_of_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("allOf");
347 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(subschemas.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().());
348
349 for (idx, subschema) in subschemas.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
350 let subschema_ctx = all_of_ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(idx);
351 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&subschema_ctx, subschema_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))
352 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
353
354 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(obj) = subschema {
355 let validators = compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&subschema_ctx, obj)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
356 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((node, validators));
357 }
358 }
359
360 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
361 }
362
363 fn compile_any_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_any_of().<'a>(
364 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
365 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
366 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
367 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(subschemas)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("anyOf").maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::as_arrayrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_array().) else {
368 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().());
369 };
370
371 let any_of_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("anyOf");
372 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(subschemas.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().());
373
374 for (idx, subschema) in subschemas.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
375 let subschema_ctx = any_of_ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(idx);
376 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&subschema_ctx, subschema_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))
377 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
378
379 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(obj) = subschema {
380 let validators = compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&subschema_ctx, obj)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
381 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((node, validators));
382 }
383 }
384
385 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
386 }
387
388 fn compile_one_ofrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_one_of().<'a>(
389 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
390 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
391 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
392 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(subschemas)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("oneOf").maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::as_arrayrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_array().) else {
393 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().());
394 };
395
396 let one_of_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("oneOf");
397 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(subschemas.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().());
398
399 for (idx, subschema) in subschemas.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
400 let subschema_ctx = one_of_ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(idx);
401 let node = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&subschema_ctx, subschema_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(subschema))
402 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
403
404 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(obj) = subschema {
405 let validators = compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&subschema_ctx, obj)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
406 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((node, validators));
407 }
408 }
409
410 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
411 }
412
413 fn compile_conditionalrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_conditional().<'a>(
414 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
415 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
416 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ConditionalValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#>>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
417 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(if_schema)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("if") else {
418 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
419 };
420
421 let if_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("if");
422 let condition = compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(
423 &if_ctx,
424 if_ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(&Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(if_schema.clonerust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`][Clone]clone().())),
425 )
426 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
427 let if_ = compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&if_ctx, if_schema)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
428
429 let then_ = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(then_schema)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("then") {
430 let then_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("then");
431 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&then_ctx, then_schema)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
432 } else {
433 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
434 };
435
436 let else_ = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(else_schema)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("else") {
437 let else_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("else");
438 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&else_ctx, else_schema)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
439 } else {
440 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
441 };
442
443 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ConditionalValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators# {
444 conditionrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#condition.,
445 if_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#if_.,
446 then_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#then_.,
447 else_rust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/ConditionalValidators#else_.,
448 })))
449 }
450
451 fn compile_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_ref().<'a>(
452 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
453 parent: &Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
454 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<RefValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/RefValidator#>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
455 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Stringrust-analyzer cargo serde_json 1.0.145 value/Value#String#(reference)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("$ref") else {
456 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
457 };
458
459 let resolved = ctx.lookuprust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]lookup().(reference).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::fromrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'_>`][`From<referencing::Error>`]from().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
460
461 let (contents, resolver, draft) = resolved.into_innerrust-analyzer cargo referencing 0.37.4 resolver/impl#[`Resolved<'r>`]into_inner().();
462 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(subschema) = &contents {
463 let vocabularies = ctx.registryrust-analyzer cargo jsonschema 0.37.4 compiler/Context#registry..find_vocabulariesrust-analyzer cargo referencing 0.37.4 registry/impl#[Registry]find_vocabularies().(draft, contents);
464 let ref_ctx =
465 ctx.with_resolver_and_draftrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]with_resolver_and_draft().(resolver, draft, vocabularies, ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().());
466 let validators =
467 compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&ref_ctx, subschema).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
468 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(RefValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/RefValidator#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(validators))))
469 } else {
470 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
471 }
472 }
473
474 fn compile_dynamic_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_dynamic_ref().<'a>(
475 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
476 parent: &Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
477 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#>>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
478 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Stringrust-analyzer cargo serde_json 1.0.145 value/Value#String#(reference)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("$dynamicRef") else {
479 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
480 };
481
482 let resolved = ctx.lookuprust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]lookup().(reference).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::fromrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'_>`][`From<referencing::Error>`]from().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
483
484 let (contents, resolver, draft) = resolved.into_innerrust-analyzer cargo referencing 0.37.4 resolver/impl#[`Resolved<'r>`]into_inner().();
485 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(subschema) = &contents {
486 let vocabularies = ctx.registryrust-analyzer cargo jsonschema 0.37.4 compiler/Context#registry..find_vocabulariesrust-analyzer cargo referencing 0.37.4 registry/impl#[Registry]find_vocabularies().(draft, contents);
487 let ref_ctx =
488 ctx.with_resolver_and_draftrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]with_resolver_and_draft().(resolver, draft, vocabularies, ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().());
489 let validators =
490 compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&ref_ctx, subschema).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
491 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(validators)))
492 } else {
493 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
494 }
495 }
496
497 fn compile_recursive_refrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_recursive_ref().<'a>(
498 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
499 parent: &Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
500 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PendingPropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PendingPropertyValidators#>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
501 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parent.contains_keyrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]contains_key().("$recursiveRef") {
502 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
503 }
504
505 // For $recursiveRef, we need to resolve the reference and check if it's already being compiled
506 let resolved = ctx
507 .lookup_recursive_referencerust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]lookup_recursive_reference().()
508 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::fromrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'_>`][`From<referencing::Error>`]from().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
509
510 // Create context for the resolved reference and check its cache key
511 let (contents, resolver, draft) = resolved.into_innerrust-analyzer cargo referencing 0.37.4 resolver/impl#[`Resolved<'r>`]into_inner().();
512 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(subschema) = &contents {
513 let vocabularies = ctx.registryrust-analyzer cargo jsonschema 0.37.4 compiler/Context#registry..find_vocabulariesrust-analyzer cargo referencing 0.37.4 registry/impl#[Registry]find_vocabularies().(draft, contents);
514 let ref_ctx =
515 ctx.with_resolver_and_draftrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]with_resolver_and_draft().(resolver, draft, vocabularies, ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().());
516
517 // Check if we're already compiling this schema (circular reference)
518 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pending) = ref_ctx.get_pending_property_validators_for_schemarust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]get_pending_property_validators_for_schema().(subschema) {
519 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pending));
520 }
521
522 let cache_key = ref_ctx.location_cache_keyrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location_cache_key().();
523 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pending) = ref_ctx.get_pending_property_validatorsrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]get_pending_property_validators().(&cache_key) {
524 // Circular reference detected - return the pending node
525 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pending));
526 }
527
528 // Not circular, compile normally
529 let validators =
530 compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&ref_ctx, subschema).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
531 let pending = Sharedrust-analyzer cargo jsonschema 0.37.4 thread/Shared#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(OnceLockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/OnceLock#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]new().());
532 let _ = pending.setrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/once_lock/impl#[`OnceLock<T>`]set().(validators);
533 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pending))
534 } else {
535 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
536 }
537 }
538
539 fn compile_dependentrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_dependent().<'a>(
540 ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#<'_>,
541 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
542 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#)>, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'a>> {
543 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map)) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("dependentSchemas") else {
544 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().());
545 };
546
547 let dependent_ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("dependentSchemas");
548 let mut result = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(map.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().());
549
550 for (property, subschema) in map {
551 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(obj) = subschema {
552 let property_ctx = dependent_ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().());
553 let validators = compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(&property_ctx, obj)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
554 result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), validators));
555 }
556 }
557
558 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
559 }
560
561 /// Validator for the `unevaluatedProperties` keyword.
562 pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct UnevaluatedPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator# {
563 locationrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#location.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#,
564 validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators.: PropertyValidatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#,
565 }
566
567 impl UnevaluatedPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator# {
568 pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[UnevaluatedPropertiesValidator]compile().<'a>(
569 ctx: &'a compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#,
570 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
571 ) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> {
572 let validators =
573 compile_property_validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile_property_validators().(ctx, parent).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::to_ownedrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]to_owned().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
574
575 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(UnevaluatedPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator# {
576 locationrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#location.: ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().joinrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]join().("unevaluatedProperties"),
577 validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators.,
578 }))
579 }
580 }
581
582 impl Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for UnevaluatedPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator# {
583 fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[UnevaluatedPropertiesValidator][Validate]validate().<'i>(
584 &self,
585 instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#,
586 location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#,
587 ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#,
588 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> {
589 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(properties) = instance {
590 let mut evaluated = AHashSetrust-analyzer cargo ahash 0.8.12 hash_set/AHashSet#::with_capacityrust-analyzer cargo ahash 0.8.12 hash_set/impl#[`AHashSet<T>`]with_capacity().(properties.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().());
591
592 // Mark all evaluated properties
593 self.validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators.
594 .mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, &mut evaluated, ctx);
595
596 // Early return if all properties are evaluated
597 if evaluated.lenrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().properties.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().() {
598 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
599 }
600
601 // Check for unevaluated properties
602 let mut unevaluated = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
603 for (property, value) in properties {
604 if evaluated.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(property) {
605 continue;
606 }
607 // Check against unevaluatedProperties schema
608 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(unevaluated_schema) = &self.validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators..unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#unevaluated. {
609 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unevaluated_schema.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) {
610 unevaluated.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().());
611 }
612 } else {
613 // No unevaluatedProperties schema means false (reject all)
614 unevaluated.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().());
615 }
616 }
617
618 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unevaluated.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
619 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::unevaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]unevaluated_properties().(
620 self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(),
621 location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
622 instance,
623 unevaluated,
624 ));
625 }
626 }
627 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
628 }
629
630 fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[UnevaluatedPropertiesValidator][Validate]is_valid().(&self, instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#) -> bool {
631 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(properties) = instance {
632 let mut evaluated = AHashSetrust-analyzer cargo ahash 0.8.12 hash_set/AHashSet#::with_capacityrust-analyzer cargo ahash 0.8.12 hash_set/impl#[`AHashSet<T>`]with_capacity().(properties.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().());
633 self.validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators.
634 .mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, &mut evaluated, ctx);
635
636 // Early return if all properties are evaluated
637 if evaluated.lenrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().properties.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().() {
638 return true;
639 }
640
641 for (property, value) in properties {
642 if evaluated.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(property) {
643 continue;
644 }
645 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(unevaluated_schema) = &self.validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators..unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#unevaluated. {
646 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unevaluated_schema.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) {
647 return false;
648 }
649 } else {
650 return false;
651 }
652 }
653 }
654 true
655 }
656
657 fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[UnevaluatedPropertiesValidator][Validate]evaluate().(
658 &self,
659 instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#,
660 location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#,
661 ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#,
662 ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# {
663 if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(properties) = instance {
664 let mut evaluated = AHashSetrust-analyzer cargo ahash 0.8.12 hash_set/AHashSet#::with_capacityrust-analyzer cargo ahash 0.8.12 hash_set/impl#[`AHashSet<T>`]with_capacity().(properties.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().());
665 self.validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators.
666 .mark_evaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[PropertyValidators]mark_evaluated_properties().(instance, &mut evaluated, ctx);
667 let mut children = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
668 let mut unevaluated = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
669 let mut invalid = false;
670
671 for (property, value) in properties {
672 if evaluated.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(property) {
673 continue;
674 }
675 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(validator) = &self.validatorsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#validators..unevaluatedrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/PropertyValidators#unevaluated. {
676 let child = validator.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property), ctx);
677 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().child.validrust-analyzer cargo jsonschema 0.37.4 evaluation/EvaluationNode#valid. {
678 invalid = true;
679 unevaluated.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().());
680 }
681 children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(child);
682 } else {
683 invalid = true;
684 unevaluated.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().());
685 }
686 }
687
688 let mut errors = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
689 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unevaluated.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
690 errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ErrorDescriptionrust-analyzer cargo jsonschema 0.37.4 evaluation/ErrorDescription#::from_validation_errorrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[ErrorDescription]from_validation_error().(
691 &ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::unevaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]unevaluated_properties().(
692 self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(),
693 location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
694 instance,
695 unevaluated,
696 ),
697 ));
698 }
699
700 if invalid {
701 EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::Invalidrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Invalid# {
702 errorsrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Invalid#errors.,
703 childrenrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Invalid#children.,
704 annotationsrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Invalid#annotations.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
705 }
706 } else {
707 EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::Validrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Valid# {
708 annotationsrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Valid#annotations.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
709 childrenrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#Valid#children.,
710 }
711 }
712 } else {
713 EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().()
714 }
715 }
716 }
717
718 pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/compile().<'a>(
719 ctx: &'a compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#,
720 parent: &'a Maprust-analyzer cargo serde_json 1.0.145 map/Map#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#>,
721 schema: &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#,
722 ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a>> {
723 match schema.as_boolrust-analyzer cargo serde_json 1.0.145 value/impl#[Value]as_bool().() {
724 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // unevaluatedProperties: true is a no-op
725 _ => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(UnevaluatedPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/UnevaluatedPropertiesValidator#::compilerust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/impl#[UnevaluatedPropertiesValidator]compile().(ctx, parent)),
726 }
727 }
728
729 #[cfg(test)]
730 mod testsrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/tests/ {
731 use craterust-analyzer cargo jsonschema 0.37.4 crate/::errorrust-analyzer cargo jsonschema 0.37.4 error/::ValidationErrorKindrust-analyzer cargo jsonschema 0.37.4 error/ValidationErrorKind#;
732 use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::jsonrust-analyzer cargo serde_json 1.0.145 macros/json!;
733
734 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
735 fn recursive_ref_preserves_unevaluated_propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/unevaluated_properties/tests/recursive_ref_preserves_unevaluated_properties().() {
736 let schema = jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({
737 "$schema": "https://json-schema.org/draft/2019-09/schema",
738 "$id": "https://example.com/root",
739 "$recursiveAnchor": true,
740 "type": "object",
741 "properties": {
742 "child": {
743 "type": "object",
744 "properties": {
745 "child": { "$recursiveRef": "#" }
746 },
747 "unevaluatedProperties": false
748 }
749 },
750 "unevaluatedProperties": false
751 });
752
753 let validator = craterust-analyzer cargo jsonschema 0.37.4 crate/::optionsrust-analyzer cargo jsonschema 0.37.4 options().().buildrust-analyzer cargo jsonschema 0.37.4 options/impl#[ValidationOptions]build().(&schema).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("schema compiles");
754
755 let valid = jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"child": {"child": {}}});
756 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
757 validator.is_validrust-analyzer cargo jsonschema 0.37.4 validator/impl#[Validator]is_valid().(&valid),
758 "expected recursive schema without extras to be valid"
759 );
760
761 let invalid = jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"child": {"child": {"unexpected": 1}}});
762 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
763 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().validator.is_validrust-analyzer cargo jsonschema 0.37.4 validator/impl#[Validator]is_valid().(&invalid),
764 "unexpected properties should be rejected"
765 );
766
767 let errors: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = validator.iter_errorsrust-analyzer cargo jsonschema 0.37.4 validator/impl#[Validator]iter_errors().(&invalid).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
768 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
769 errors.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|err| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(
770 err.kindrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]kind().(),
771 ValidationErrorKindrust-analyzer cargo jsonschema 0.37.4 error/ValidationErrorKind#::UnevaluatedPropertiesrust-analyzer cargo jsonschema 0.37.4 error/ValidationErrorKind#UnevaluatedProperties# { .. }
772 )),
773 "expected unevaluatedProperties error, got {errors:?}"
774 );
775 }
776 }