| 1 | //! # Description |
| 2 | //! This module contains various validators for the `additionalProperties` keyword. |
| 3 | //! |
| 4 | //! The goal here is to compute intersections with another keywords affecting properties validation: |
| 5 | //! - `properties` |
| 6 | //! - `patternProperties` |
| 7 | //! |
| 8 | //! Each valid combination of these keywords has a validator here. |
| 9 | use craterust-analyzer cargo jsonschema 0.37.4 crate/::{ |
| 10 | compilerrust-analyzer cargo jsonschema 0.37.4 compiler/, |
| 11 | errorrust-analyzer cargo jsonschema 0.37.4 error/::{no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error()., ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#, ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#}, |
| 12 | evaluationrust-analyzer cargo jsonschema 0.37.4 evaluation/::{format_schema_locationrust-analyzer cargo jsonschema 0.37.4 evaluation/format_schema_location()., Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#, ErrorDescriptionrust-analyzer cargo jsonschema 0.37.4 evaluation/ErrorDescription#, EvaluationNoderust-analyzer cargo jsonschema 0.37.4 evaluation/EvaluationNode#}, |
| 13 | keywordsrust-analyzer cargo jsonschema 0.37.4 keywords/::CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#, |
| 14 | noderust-analyzer cargo jsonschema 0.37.4 node/::SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, |
| 15 | optionsrust-analyzer cargo jsonschema 0.37.4 options/::PatternEngineOptionsrust-analyzer cargo jsonschema 0.37.4 options/PatternEngineOptions#, |
| 16 | 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#}, |
| 17 | propertiesrust-analyzer cargo jsonschema 0.37.4 properties/::{ |
| 18 | are_properties_validrust-analyzer cargo jsonschema 0.37.4 properties/are_properties_valid()., compile_big_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_big_map()., compile_dynamic_prop_map_validatorrust-analyzer cargo jsonschema 0.37.4 properties/compile_dynamic_prop_map_validator!, |
| 19 | compile_fancy_regex_patternsrust-analyzer cargo jsonschema 0.37.4 properties/compile_fancy_regex_patterns()., compile_regex_patternsrust-analyzer cargo jsonschema 0.37.4 properties/compile_regex_patterns()., compile_small_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_small_map()., BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap#, |
| 20 | PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#, SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap#, |
| 21 | }, |
| 22 | regexrust-analyzer cargo jsonschema 0.37.4 regex/::RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#, |
| 23 | typesrust-analyzer cargo jsonschema 0.37.4 types/::JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#, |
| 24 | 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#}, |
| 25 | }; |
| 26 | use referencingrust-analyzer cargo referencing 0.37.4 crate/::Urirust-analyzer cargo fluent-uri 0.4.1 imp/Uri#; |
| 27 | 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#}; |
| 28 | 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/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#; |
| 29 | |
| 30 | /// # Schema example |
| 31 | /// |
| 32 | /// ```json |
| 33 | /// { |
| 34 | /// "additionalProperties": {"type": "integer"}, |
| 35 | /// } |
| 36 | /// ``` |
| 37 | /// |
| 38 | /// # Valid value |
| 39 | /// |
| 40 | /// ```json |
| 41 | /// { |
| 42 | /// "bar": 6 |
| 43 | /// } |
| 44 | /// ``` |
| 45 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator# { |
| 46 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#node.: SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, |
| 47 | } |
| 48 | impl AdditionalPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator# { |
| 49 | #[inline] |
| 50 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesValidator]compile().<'a>(schema: &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> { |
| 51 | let ctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 52 | 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().(AdditionalPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator# { |
| 53 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#node.: compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&ctx, ctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 54 | })) |
| 55 | } |
| 56 | } |
| 57 | impl Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for AdditionalPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator# { |
| 58 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesValidator][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 { |
| 59 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 60 | item.valuesrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]values().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|i| self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#node..is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(i, ctx)) |
| 61 | } else { |
| 62 | true |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesValidator][Validate]validate().<'i>( |
| 67 | &self, |
| 68 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 69 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 70 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 71 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 72 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 73 | for (name, value) in item { |
| 74 | self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#node..validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name), ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 75 | } |
| 76 | } |
| 77 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 78 | } |
| 79 | |
| 80 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesValidator][Validate]iter_errors().<'i>( |
| 81 | &self, |
| 82 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 83 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 84 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 85 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 86 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 87 | 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().(); |
| 88 | for (name, value) in item { |
| 89 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().( |
| 90 | self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#node. |
| 91 | .iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), ctx), |
| 92 | ); |
| 93 | } |
| 94 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 95 | } else { |
| 96 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesValidator][Validate]evaluate().( |
| 101 | &self, |
| 102 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 103 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 104 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 105 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 106 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 107 | let mut children = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 108 | for (name, value) in item { |
| 109 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#node..evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().( |
| 110 | value, |
| 111 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 112 | ctx, |
| 113 | )); |
| 114 | } |
| 115 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 116 | let annotated_props = item |
| 117 | .keysrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]keys().() |
| 118 | .clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().() |
| 119 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Stringrust-analyzer cargo serde_json 1.0.145 value/Value#String#) |
| 120 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 121 | result.annotaterust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]annotate().(Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#::newrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[Annotations]new().(serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Arrayrust-analyzer cargo serde_json 1.0.145 value/Value#Array#(annotated_props))); |
| 122 | result |
| 123 | } else { |
| 124 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /// # Schema example |
| 130 | /// |
| 131 | /// ```json |
| 132 | /// { |
| 133 | /// "additionalProperties": false |
| 134 | /// } |
| 135 | /// ``` |
| 136 | /// |
| 137 | /// # Valid value |
| 138 | /// |
| 139 | /// ```json |
| 140 | /// {} |
| 141 | /// ``` |
| 142 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator# { |
| 143 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator#location.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, |
| 144 | } |
| 145 | impl AdditionalPropertiesFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator# { |
| 146 | #[inline] |
| 147 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesFalseValidator]compile().<'a>(location: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> { |
| 148 | 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().(AdditionalPropertiesFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator# { locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator#location. })) |
| 149 | } |
| 150 | } |
| 151 | impl Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for AdditionalPropertiesFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator# { |
| 152 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesFalseValidator][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 { |
| 153 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 154 | item.iterrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]iter().().nextrust-analyzer cargo serde_json 1.0.145 map/impl#[`Iter<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() |
| 155 | } else { |
| 156 | true |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesFalseValidator][Validate]validate().<'i>( |
| 161 | &self, |
| 162 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 163 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 164 | _ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 165 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 166 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 167 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((_, value)) = item.iterrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]iter().().nextrust-analyzer cargo serde_json 1.0.145 map/impl#[`Iter<'a>`][Iterator]next().() { |
| 168 | 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#::false_schemarust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]false_schema().( |
| 169 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 170 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 171 | value, |
| 172 | )); |
| 173 | } |
| 174 | } |
| 175 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | /// # Schema example |
| 180 | /// |
| 181 | /// ```json |
| 182 | /// { |
| 183 | /// "additionalProperties": false, |
| 184 | /// "properties": { |
| 185 | /// "foo": {"type": "string"} |
| 186 | /// }, |
| 187 | /// } |
| 188 | /// ``` |
| 189 | /// |
| 190 | /// # Valid value |
| 191 | /// |
| 192 | /// ```json |
| 193 | /// { |
| 194 | /// "foo": "bar", |
| 195 | /// } |
| 196 | /// ``` |
| 197 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#> { |
| 198 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties.: M, |
| 199 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#location.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, |
| 200 | } |
| 201 | impl AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#<SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap#> { |
| 202 | #[inline] |
| 203 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyFalseValidator<Vec<(String, SchemaNode)>>`]compile().<'a>( |
| 204 | map: &'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#>, |
| 205 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 206 | ) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> { |
| 207 | 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().(AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator# { |
| 208 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties.: compile_small_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_small_map().(ctx, map)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 209 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#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().("additionalProperties"), |
| 210 | })) |
| 211 | } |
| 212 | } |
| 213 | impl AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#<BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap#> { |
| 214 | #[inline] |
| 215 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyFalseValidator<ahash::AHashMap<String, SchemaNode>>`]compile().<'a>( |
| 216 | map: &'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#>, |
| 217 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 218 | ) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> { |
| 219 | 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().(AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator# { |
| 220 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties.: compile_big_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_big_map().(ctx, map)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 221 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#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().("additionalProperties"), |
| 222 | })) |
| 223 | } |
| 224 | } |
| 225 | impl<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#> Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#<M> { |
| 226 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyFalseValidator<M>`][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 { |
| 227 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(props) = instance { |
| 228 | are_properties_validrust-analyzer cargo jsonschema 0.37.4 properties/are_properties_valid().(&self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties., props, ctx, |_, _| false) |
| 229 | } else { |
| 230 | true |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyFalseValidator<M>`][Validate]validate().<'i>( |
| 235 | &self, |
| 236 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 237 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 238 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 239 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 240 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 241 | for (property, value) in item { |
| 242 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 243 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name), ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 244 | } else { |
| 245 | 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#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 246 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 247 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 248 | instance, |
| 249 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()], |
| 250 | )); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 255 | } |
| 256 | |
| 257 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyFalseValidator<M>`][Validate]iter_errors().<'i>( |
| 258 | &self, |
| 259 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 260 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 261 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 262 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 263 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 264 | let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 265 | let mut unexpected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 266 | for (property, value) in item { |
| 267 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 268 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), ctx)); |
| 269 | } else { |
| 270 | unexpected.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().()); |
| 271 | } |
| 272 | } |
| 273 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unexpected.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 274 | errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 275 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 276 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 277 | instance, |
| 278 | unexpected, |
| 279 | )); |
| 280 | } |
| 281 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 282 | } else { |
| 283 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyFalseValidator<M>`][Validate]evaluate().( |
| 288 | &self, |
| 289 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 290 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 291 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 292 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 293 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 294 | let mut unexpected = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 295 | let mut children = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 296 | for (property, value) in item { |
| 297 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((_name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 298 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().( |
| 299 | value, |
| 300 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 301 | ctx, |
| 302 | )); |
| 303 | } else { |
| 304 | unexpected.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().()); |
| 305 | } |
| 306 | } |
| 307 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 308 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unexpected.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 309 | result.mark_erroredrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]mark_errored().(ErrorDescriptionrust-analyzer cargo jsonschema 0.37.4 evaluation/ErrorDescription#::from_validation_errorrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[ErrorDescription]from_validation_error().( |
| 310 | &ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 311 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 312 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 313 | instance, |
| 314 | unexpected, |
| 315 | ), |
| 316 | )); |
| 317 | } |
| 318 | result |
| 319 | } else { |
| 320 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | /// # Schema example |
| 326 | /// |
| 327 | /// ```json |
| 328 | /// { |
| 329 | /// "additionalProperties": {"type": "integer"}, |
| 330 | /// "properties": { |
| 331 | /// "foo": {"type": "string"} |
| 332 | /// } |
| 333 | /// } |
| 334 | /// ``` |
| 335 | /// |
| 336 | /// # Valid value |
| 337 | /// |
| 338 | /// ```json |
| 339 | /// { |
| 340 | /// "foo": "bar", |
| 341 | /// "bar": 6 |
| 342 | /// } |
| 343 | /// ``` |
| 344 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#> { |
| 345 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node.: SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, |
| 346 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties.: M, |
| 347 | } |
| 348 | impl AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#<SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap#> { |
| 349 | #[inline] |
| 350 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyValidator<Vec<(String, SchemaNode)>>`]compile().<'a>( |
| 351 | map: &'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#>, |
| 352 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 353 | schema: &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 354 | ) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> { |
| 355 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 356 | 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().(AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator# { |
| 357 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties.: compile_small_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_small_map().(ctx, map)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 358 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node.: compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&kctx, kctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 359 | })) |
| 360 | } |
| 361 | } |
| 362 | impl AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#<BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap#> { |
| 363 | #[inline] |
| 364 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyValidator<ahash::AHashMap<String, SchemaNode>>`]compile().<'a>( |
| 365 | map: &'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 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 367 | schema: &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 368 | ) -> CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a> { |
| 369 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 370 | 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().(AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator# { |
| 371 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties.: compile_big_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_big_map().(ctx, map)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 372 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node.: compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&kctx, kctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 373 | })) |
| 374 | } |
| 375 | } |
| 376 | impl<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#> Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#<M> { |
| 377 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyValidator<M>`][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 { |
| 378 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(props) = instance { |
| 379 | are_properties_validrust-analyzer cargo jsonschema 0.37.4 properties/are_properties_valid().(&self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties., props, ctx, |instance, ctx| { |
| 380 | self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node..is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(instance, ctx) |
| 381 | }) |
| 382 | } else { |
| 383 | true |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyValidator<M>`][Validate]validate().<'i>( |
| 388 | &self, |
| 389 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 390 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 391 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 392 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 393 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(props) = instance { |
| 394 | for (property, value) in props { |
| 395 | let property_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property); |
| 396 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(validator) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties..get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_validator().(property) { |
| 397 | validator.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 398 | } else { |
| 399 | self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node..validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 404 | } |
| 405 | |
| 406 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyValidator<M>`][Validate]iter_errors().<'i>( |
| 407 | &self, |
| 408 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 409 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 410 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 411 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 412 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map) = instance { |
| 413 | let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 414 | for (property, value) in map { |
| 415 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, property_validators)) = |
| 416 | self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) |
| 417 | { |
| 418 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(property_validators.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 419 | value, |
| 420 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 421 | ctx, |
| 422 | )); |
| 423 | } else { |
| 424 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node..iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 425 | value, |
| 426 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 427 | ctx, |
| 428 | )); |
| 429 | } |
| 430 | } |
| 431 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 432 | } else { |
| 433 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesNotEmptyValidator<M>`][Validate]evaluate().( |
| 438 | &self, |
| 439 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 440 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 441 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 442 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 443 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map) = instance { |
| 444 | let mut matched_propnames = 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().()); |
| 445 | let mut children = 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().()); |
| 446 | for (property, value) in map { |
| 447 | let path = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 448 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((_name, property_validators)) = |
| 449 | self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) |
| 450 | { |
| 451 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(property_validators.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 452 | } else { |
| 453 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#node..evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 454 | matched_propnames.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().()); |
| 455 | } |
| 456 | } |
| 457 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 458 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matched_propnames.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 459 | result.annotaterust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]annotate().(Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#::newrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[Annotations]new().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::fromrust-analyzer cargo serde_json 1.0.145 value/from/impl#[Value][`From<Vec<T>>`]from().(matched_propnames))); |
| 460 | } |
| 461 | result |
| 462 | } else { |
| 463 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 464 | } |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | /// # Schema example |
| 469 | /// |
| 470 | /// ```json |
| 471 | /// { |
| 472 | /// "additionalProperties": {"type": "integer"}, |
| 473 | /// "patternProperties": { |
| 474 | /// "^x-": {"type": "integer", "minimum": 5}, |
| 475 | /// "-x$": {"type": "integer", "maximum": 10} |
| 476 | /// } |
| 477 | /// } |
| 478 | /// ``` |
| 479 | /// |
| 480 | /// # Valid value |
| 481 | /// |
| 482 | /// ```json |
| 483 | /// { |
| 484 | /// "x-foo": 6, |
| 485 | /// "foo-x": 7, |
| 486 | /// "bar": 8 |
| 487 | /// } |
| 488 | /// ``` |
| 489 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesWithPatternsValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#<R> { |
| 490 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node.: SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, |
| 491 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(R, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, |
| 492 | /// We need this because `compiler::compile` uses the additionalProperties keyword to compile |
| 493 | /// this validator. That means that the schema node which contains this validator has |
| 494 | /// "additionalProperties" as it's path. However, we need to produce annotations which have the |
| 495 | /// patternProperties keyword as their path so we store the paths here. |
| 496 | pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_path.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, |
| 497 | pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_absolute_location.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Urirust-analyzer cargo fluent-uri 0.4.1 imp/Uri#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>>, |
| 498 | } |
| 499 | |
| 500 | impl<R: RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#> Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for AdditionalPropertiesWithPatternsValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#<R> { |
| 501 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsValidator<R>`][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 { |
| 502 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 503 | for (property, value) in item { |
| 504 | let mut has_match = false; |
| 505 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns. { |
| 506 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 507 | has_match = true; |
| 508 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 509 | return false; |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node..is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 514 | return false; |
| 515 | } |
| 516 | } |
| 517 | } |
| 518 | true |
| 519 | } |
| 520 | |
| 521 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsValidator<R>`][Validate]validate().<'i>( |
| 522 | &self, |
| 523 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 524 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 525 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 526 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 527 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 528 | for (property, value) in item { |
| 529 | let property_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property); |
| 530 | let mut has_match = false; |
| 531 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns. { |
| 532 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 533 | has_match = true; |
| 534 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 535 | } |
| 536 | } |
| 537 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 538 | self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node..validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 543 | } |
| 544 | |
| 545 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsValidator<R>`][Validate]iter_errors().<'i>( |
| 546 | &self, |
| 547 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 548 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 549 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 550 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 551 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 552 | let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 553 | for (property, value) in item { |
| 554 | let mut has_match = false; |
| 555 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns. { |
| 556 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 557 | has_match = true; |
| 558 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 559 | value, |
| 560 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 561 | ctx, |
| 562 | )); |
| 563 | } |
| 564 | } |
| 565 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 566 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node..iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 567 | value, |
| 568 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 569 | ctx, |
| 570 | )); |
| 571 | } |
| 572 | } |
| 573 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 574 | } else { |
| 575 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsValidator<R>`][Validate]evaluate().( |
| 580 | &self, |
| 581 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 582 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 583 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 584 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 585 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 586 | let mut pattern_matched_propnames = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 587 | let mut additional_matched_propnames = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 588 | let mut children = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 589 | for (property, value) in item { |
| 590 | let path = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 591 | let mut has_match = false; |
| 592 | for (pattern, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns. { |
| 593 | if pattern.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 594 | has_match = true; |
| 595 | pattern_matched_propnames.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().()); |
| 596 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 597 | } |
| 598 | } |
| 599 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 600 | additional_matched_propnames.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().()); |
| 601 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node..evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 602 | } |
| 603 | } |
| 604 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().pattern_matched_propnames.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 605 | let annotation = Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#::newrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[Annotations]new().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::fromrust-analyzer cargo serde_json 1.0.145 value/from/impl#[Value][`From<Vec<T>>`]from().(pattern_matched_propnames)); |
| 606 | let schema_location = format_schema_locationrust-analyzer cargo jsonschema 0.37.4 evaluation/format_schema_location().( |
| 607 | &self.pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_path., |
| 608 | self.pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_absolute_location..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 609 | ); |
| 610 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(EvaluationNoderust-analyzer cargo jsonschema 0.37.4 evaluation/EvaluationNode#::validrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[EvaluationNode]valid().( |
| 611 | self.pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_path..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 612 | self.pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_absolute_location..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().(), |
| 613 | schema_location, |
| 614 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 615 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(annotation), |
| 616 | 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().(), |
| 617 | )); |
| 618 | } |
| 619 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 620 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().additional_matched_propnames.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 621 | result.annotaterust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]annotate().(Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#::newrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[Annotations]new().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::fromrust-analyzer cargo serde_json 1.0.145 value/from/impl#[Value][`From<Vec<T>>`]from().(additional_matched_propnames))); |
| 622 | } |
| 623 | result |
| 624 | } else { |
| 625 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | /// # Schema example |
| 631 | /// |
| 632 | /// ```json |
| 633 | /// { |
| 634 | /// "additionalProperties": false, |
| 635 | /// "patternProperties": { |
| 636 | /// "^x-": {"type": "integer", "minimum": 5}, |
| 637 | /// "-x$": {"type": "integer", "maximum": 10} |
| 638 | /// } |
| 639 | /// } |
| 640 | /// ``` |
| 641 | /// |
| 642 | /// # Valid value |
| 643 | /// |
| 644 | /// ```json |
| 645 | /// { |
| 646 | /// "x-bar": 6, |
| 647 | /// "spam-x": 7, |
| 648 | /// "x-baz-x": 8, |
| 649 | /// } |
| 650 | /// ``` |
| 651 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesWithPatternsFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#<R> { |
| 652 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(R, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, |
| 653 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#location.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, |
| 654 | pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_path.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, |
| 655 | pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_absolute_location.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<Urirust-analyzer cargo fluent-uri 0.4.1 imp/Uri#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>>, |
| 656 | } |
| 657 | |
| 658 | impl<R: RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#> Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# for AdditionalPropertiesWithPatternsFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#<R> { |
| 659 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsFalseValidator<R>`][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 { |
| 660 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 661 | for (property, value) in item { |
| 662 | let mut has_match = false; |
| 663 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns. { |
| 664 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 665 | has_match = true; |
| 666 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 667 | return false; |
| 668 | } |
| 669 | } |
| 670 | } |
| 671 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 672 | return false; |
| 673 | } |
| 674 | } |
| 675 | } |
| 676 | true |
| 677 | } |
| 678 | |
| 679 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsFalseValidator<R>`][Validate]validate().<'i>( |
| 680 | &self, |
| 681 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 682 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 683 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 684 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 685 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 686 | for (property, value) in item { |
| 687 | let property_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property); |
| 688 | let mut has_match = false; |
| 689 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns. { |
| 690 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 691 | has_match = true; |
| 692 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 693 | } |
| 694 | } |
| 695 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 696 | 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#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 697 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 698 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 699 | instance, |
| 700 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()], |
| 701 | )); |
| 702 | } |
| 703 | } |
| 704 | } |
| 705 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 706 | } |
| 707 | |
| 708 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsFalseValidator<R>`][Validate]iter_errors().<'i>( |
| 709 | &self, |
| 710 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 711 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 712 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 713 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 714 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 715 | let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 716 | let mut unexpected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 717 | for (property, value) in item { |
| 718 | let mut has_match = false; |
| 719 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns. { |
| 720 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 721 | has_match = true; |
| 722 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 723 | value, |
| 724 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 725 | ctx, |
| 726 | )); |
| 727 | } |
| 728 | } |
| 729 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 730 | unexpected.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().()); |
| 731 | } |
| 732 | } |
| 733 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unexpected.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 734 | errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 735 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 736 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 737 | instance, |
| 738 | unexpected, |
| 739 | )); |
| 740 | } |
| 741 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 742 | } else { |
| 743 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsFalseValidator<R>`][Validate]evaluate().( |
| 748 | &self, |
| 749 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 750 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 751 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 752 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 753 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 754 | let mut unexpected = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 755 | let mut pattern_matched_props = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 756 | let mut children = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 757 | for (property, value) in item { |
| 758 | let path = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 759 | let mut has_match = false; |
| 760 | for (pattern, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns. { |
| 761 | if pattern.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 762 | has_match = true; |
| 763 | pattern_matched_props.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().()); |
| 764 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 765 | } |
| 766 | } |
| 767 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 768 | unexpected.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().()); |
| 769 | } |
| 770 | } |
| 771 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().pattern_matched_props.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 772 | let annotation = Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#::newrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[Annotations]new().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::fromrust-analyzer cargo serde_json 1.0.145 value/from/impl#[Value][`From<Vec<T>>`]from().(pattern_matched_props)); |
| 773 | let schema_location = format_schema_locationrust-analyzer cargo jsonschema 0.37.4 evaluation/format_schema_location().( |
| 774 | &self.pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_path., |
| 775 | self.pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_absolute_location..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), |
| 776 | ); |
| 777 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(EvaluationNoderust-analyzer cargo jsonschema 0.37.4 evaluation/EvaluationNode#::validrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[EvaluationNode]valid().( |
| 778 | self.pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_path..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 779 | self.pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_absolute_location..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().(), |
| 780 | schema_location, |
| 781 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 782 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(annotation), |
| 783 | 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().(), |
| 784 | )); |
| 785 | } |
| 786 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 787 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unexpected.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 788 | result.mark_erroredrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]mark_errored().(ErrorDescriptionrust-analyzer cargo jsonschema 0.37.4 evaluation/ErrorDescription#::from_validation_errorrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[ErrorDescription]from_validation_error().( |
| 789 | &ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 790 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 791 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 792 | instance, |
| 793 | unexpected, |
| 794 | ), |
| 795 | )); |
| 796 | } |
| 797 | result |
| 798 | } else { |
| 799 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 800 | } |
| 801 | } |
| 802 | } |
| 803 | |
| 804 | /// # Schema example |
| 805 | /// |
| 806 | /// ```json |
| 807 | /// { |
| 808 | /// "additionalProperties": {"type": "integer"}, |
| 809 | /// "properties": { |
| 810 | /// "foo": {"type": "string"} |
| 811 | /// }, |
| 812 | /// "patternProperties": { |
| 813 | /// "^x-": {"type": "integer", "minimum": 5}, |
| 814 | /// "-x$": {"type": "integer", "maximum": 10} |
| 815 | /// } |
| 816 | /// } |
| 817 | /// ``` |
| 818 | /// |
| 819 | /// # Valid value |
| 820 | /// |
| 821 | /// ```json |
| 822 | /// { |
| 823 | /// "foo": "a", |
| 824 | /// "x-spam": 6, |
| 825 | /// "spam-x": 7, |
| 826 | /// "x-spam-x": 8, |
| 827 | /// "bar": 42 |
| 828 | /// } |
| 829 | /// ``` |
| 830 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesWithPatternsNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#, R> { |
| 831 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node.: SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#, |
| 832 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties.: M, |
| 833 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(R, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, |
| 834 | } |
| 835 | |
| 836 | impl<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#, R: RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#> Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# |
| 837 | for AdditionalPropertiesWithPatternsNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#<M, R> |
| 838 | { |
| 839 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyValidator<M, R>`][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 { |
| 840 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 841 | for (property, value) in item { |
| 842 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(node) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties..get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_validator().(property) { |
| 843 | if node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 844 | for (re, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 845 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) |
| 846 | && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().pattern_node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) |
| 847 | { |
| 848 | return false; |
| 849 | } |
| 850 | } |
| 851 | } else { |
| 852 | return false; |
| 853 | } |
| 854 | } else { |
| 855 | let mut has_match = false; |
| 856 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 857 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 858 | has_match = true; |
| 859 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 860 | return false; |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node..is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 865 | return false; |
| 866 | } |
| 867 | } |
| 868 | } |
| 869 | true |
| 870 | } else { |
| 871 | true |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyValidator<M, R>`][Validate]validate().<'i>( |
| 876 | &self, |
| 877 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 878 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 879 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 880 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 881 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 882 | for (property, value) in item { |
| 883 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 884 | let name_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name); |
| 885 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &name_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 886 | for (re, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 887 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 888 | pattern_node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &name_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 889 | } |
| 890 | } |
| 891 | } else { |
| 892 | let property_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property); |
| 893 | let mut has_match = false; |
| 894 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 895 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 896 | has_match = true; |
| 897 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 898 | } |
| 899 | } |
| 900 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 901 | self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node..validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 902 | } |
| 903 | } |
| 904 | } |
| 905 | } |
| 906 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 907 | } |
| 908 | |
| 909 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyValidator<M, R>`][Validate]iter_errors().<'i>( |
| 910 | &self, |
| 911 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 912 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 913 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 914 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 915 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 916 | let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 917 | for (property, value) in item { |
| 918 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 919 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), ctx)); |
| 920 | for (re, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 921 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 922 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(pattern_node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 923 | value, |
| 924 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 925 | ctx, |
| 926 | )); |
| 927 | } |
| 928 | } |
| 929 | } else { |
| 930 | let mut has_match = false; |
| 931 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 932 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 933 | has_match = true; |
| 934 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 935 | value, |
| 936 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 937 | ctx, |
| 938 | )); |
| 939 | } |
| 940 | } |
| 941 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 942 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node..iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 943 | value, |
| 944 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 945 | ctx, |
| 946 | )); |
| 947 | } |
| 948 | } |
| 949 | } |
| 950 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 951 | } else { |
| 952 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 953 | } |
| 954 | } |
| 955 | |
| 956 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyValidator<M, R>`][Validate]evaluate().( |
| 957 | &self, |
| 958 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 959 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 960 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 961 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 962 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 963 | let mut additional_matches = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 964 | let mut children = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 965 | for (property, value) in item { |
| 966 | let path = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 967 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((_name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 968 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 969 | for (pattern, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 970 | if pattern.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 971 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(pattern_node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 972 | } |
| 973 | } |
| 974 | } else { |
| 975 | let mut has_match = false; |
| 976 | for (pattern, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns. { |
| 977 | if pattern.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 978 | has_match = true; |
| 979 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 980 | } |
| 981 | } |
| 982 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 983 | additional_matches.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().()); |
| 984 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(self.noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node..evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 985 | } |
| 986 | } |
| 987 | } |
| 988 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 989 | result.annotaterust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]annotate().(Annotationsrust-analyzer cargo jsonschema 0.37.4 evaluation/Annotations#::newrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[Annotations]new().(Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::fromrust-analyzer cargo serde_json 1.0.145 value/from/impl#[Value][`From<Vec<T>>`]from().(additional_matches))); |
| 990 | result |
| 991 | } else { |
| 992 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 993 | } |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | /// # Schema example |
| 998 | /// |
| 999 | /// ```json |
| 1000 | /// { |
| 1001 | /// "additionalProperties": false, |
| 1002 | /// "properties": { |
| 1003 | /// "foo": {"type": "string"} |
| 1004 | /// }, |
| 1005 | /// "patternProperties": { |
| 1006 | /// "^x-": {"type": "integer", "minimum": 5}, |
| 1007 | /// "-x$": {"type": "integer", "maximum": 10} |
| 1008 | /// } |
| 1009 | /// } |
| 1010 | /// ``` |
| 1011 | /// |
| 1012 | /// # Valid value |
| 1013 | /// |
| 1014 | /// ```json |
| 1015 | /// { |
| 1016 | /// "foo": "bar", |
| 1017 | /// "x-bar": 6, |
| 1018 | /// "spam-x": 7, |
| 1019 | /// "x-baz-x": 8, |
| 1020 | /// } |
| 1021 | /// ``` |
| 1022 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) struct AdditionalPropertiesWithPatternsNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#< |
| 1023 | M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#, |
| 1024 | R, |
| 1025 | > { |
| 1026 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties.: M, |
| 1027 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(R, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, |
| 1028 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#location.: Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#, |
| 1029 | } |
| 1030 | |
| 1031 | impl<M: PropertiesValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#, R: RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#> Validaterust-analyzer cargo jsonschema 0.37.4 validator/Validate# |
| 1032 | for AdditionalPropertiesWithPatternsNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#<M, R> |
| 1033 | { |
| 1034 | fn is_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyFalseValidator<M, R>`][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 { |
| 1035 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 1036 | for (property, value) in item { |
| 1037 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(node) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties..get_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_validator().(property) { |
| 1038 | if node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 1039 | for (re, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1040 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) |
| 1041 | && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().pattern_node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) |
| 1042 | { |
| 1043 | return false; |
| 1044 | } |
| 1045 | } |
| 1046 | } else { |
| 1047 | return false; |
| 1048 | } |
| 1049 | } else { |
| 1050 | let mut has_match = false; |
| 1051 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1052 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1053 | has_match = true; |
| 1054 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().node.is_validrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]is_valid().(value, ctx) { |
| 1055 | return false; |
| 1056 | } |
| 1057 | } |
| 1058 | } |
| 1059 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 1060 | return false; |
| 1061 | } |
| 1062 | } |
| 1063 | } |
| 1064 | } |
| 1065 | true |
| 1066 | } |
| 1067 | |
| 1068 | fn validaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyFalseValidator<M, R>`][Validate]validate().<'i>( |
| 1069 | &self, |
| 1070 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 1071 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 1072 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 1073 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#<'i>> { |
| 1074 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 1075 | for (property, value) in item { |
| 1076 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 1077 | let name_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name); |
| 1078 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &name_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1079 | for (re, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1080 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1081 | pattern_node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &name_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1082 | } |
| 1083 | } |
| 1084 | } else { |
| 1085 | let property_location = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property); |
| 1086 | let mut has_match = false; |
| 1087 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1088 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1089 | has_match = true; |
| 1090 | node.validaterust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]validate().(value, &property_location, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1091 | } |
| 1092 | } |
| 1093 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 1094 | 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#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 1095 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 1096 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1097 | instance, |
| 1098 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![property.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()], |
| 1099 | )); |
| 1100 | } |
| 1101 | } |
| 1102 | } |
| 1103 | } |
| 1104 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 1105 | } |
| 1106 | |
| 1107 | fn iter_errorsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyFalseValidator<M, R>`][Validate]iter_errors().<'i>( |
| 1108 | &self, |
| 1109 | instance: &'i Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 1110 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 1111 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 1112 | ) -> ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#<'i> { |
| 1113 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 1114 | let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 1115 | let mut unexpected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 1116 | for (property, value) in item { |
| 1117 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 1118 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().(value, &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), ctx)); |
| 1119 | for (re, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1120 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1121 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(pattern_node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 1122 | value, |
| 1123 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 1124 | ctx, |
| 1125 | )); |
| 1126 | } |
| 1127 | } |
| 1128 | } else { |
| 1129 | let mut has_match = false; |
| 1130 | for (re, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1131 | if re.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1132 | has_match = true; |
| 1133 | errors.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(node.iter_errorsrust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode][Validate]iter_errors().( |
| 1134 | value, |
| 1135 | &location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 1136 | ctx, |
| 1137 | )); |
| 1138 | } |
| 1139 | } |
| 1140 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 1141 | unexpected.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().()); |
| 1142 | } |
| 1143 | } |
| 1144 | } |
| 1145 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unexpected.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 1146 | errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 1147 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 1148 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1149 | instance, |
| 1150 | unexpected, |
| 1151 | )); |
| 1152 | } |
| 1153 | ErrorIteratorrust-analyzer cargo jsonschema 0.37.4 error/ErrorIterator#::from_iteratorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ErrorIterator<'a>`]from_iterator().(errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()) |
| 1154 | } else { |
| 1155 | no_errorrust-analyzer cargo jsonschema 0.37.4 error/no_error().() |
| 1156 | } |
| 1157 | } |
| 1158 | |
| 1159 | fn evaluaterust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[`AdditionalPropertiesWithPatternsNotEmptyFalseValidator<M, R>`][Validate]evaluate().( |
| 1160 | &self, |
| 1161 | instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 1162 | location: &LazyLocationrust-analyzer cargo jsonschema 0.37.4 paths/LazyLocation#, |
| 1163 | ctx: &mut ValidationContextrust-analyzer cargo jsonschema 0.37.4 validator/ValidationContext#, |
| 1164 | ) -> EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult# { |
| 1165 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(item) = instance { |
| 1166 | let mut unexpected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 1167 | let mut children = 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().(item.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().()); |
| 1168 | for (property, value) in item { |
| 1169 | let path = location.pushrust-analyzer cargo jsonschema 0.37.4 paths/impl#[`LazyLocation<'a, '_>`]push().(property.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()); |
| 1170 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((_name, node)) = self.propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties..get_key_validatorrust-analyzer cargo jsonschema 0.37.4 properties/PropertiesValidatorsMap#get_key_validator().(property) { |
| 1171 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 1172 | for (pattern, pattern_node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1173 | if pattern.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1174 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(pattern_node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 1175 | } |
| 1176 | } |
| 1177 | } else { |
| 1178 | let mut has_match = false; |
| 1179 | for (pattern, node) in &self.patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns. { |
| 1180 | if pattern.is_matchrust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine#is_match().(property).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(false) { |
| 1181 | has_match = true; |
| 1182 | children.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(node.evaluate_instancerust-analyzer cargo jsonschema 0.37.4 node/impl#[SchemaNode]evaluate_instance().(value, &path, ctx)); |
| 1183 | } |
| 1184 | } |
| 1185 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_match { |
| 1186 | unexpected.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().()); |
| 1187 | } |
| 1188 | } |
| 1189 | } |
| 1190 | let mut result = EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::from_childrenrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]from_children().(children); |
| 1191 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unexpected.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 1192 | result.mark_erroredrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]mark_errored().(ErrorDescriptionrust-analyzer cargo jsonschema 0.37.4 evaluation/ErrorDescription#::from_validation_errorrust-analyzer cargo jsonschema 0.37.4 evaluation/impl#[ErrorDescription]from_validation_error().( |
| 1193 | &ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::additional_propertiesrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]additional_properties().( |
| 1194 | self.locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#location..clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 1195 | location.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1196 | instance, |
| 1197 | unexpected, |
| 1198 | ), |
| 1199 | )); |
| 1200 | } |
| 1201 | result |
| 1202 | } else { |
| 1203 | EvaluationResultrust-analyzer cargo jsonschema 0.37.4 validator/EvaluationResult#::valid_emptyrust-analyzer cargo jsonschema 0.37.4 validator/impl#[EvaluationResult]valid_empty().() |
| 1204 | } |
| 1205 | } |
| 1206 | } |
| 1207 | |
| 1208 | macro_rules! try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile! { |
| 1209 | ($expr:expr) => { |
| 1210 | match $expr { |
| 1211 | Ok(result) => result, |
| 1212 | Err(error) => return Some(Err(error)), |
| 1213 | } |
| 1214 | }; |
| 1215 | } |
| 1216 | |
| 1217 | fn compile_pattern_non_emptyrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile_pattern_non_empty().<'a, R>( |
| 1218 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 1219 | map: &'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#>, |
| 1220 | patterns: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(R, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, |
| 1221 | schema: &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 1222 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a>> |
| 1223 | where |
| 1224 | R: RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine# + 'static, |
| 1225 | { |
| 1226 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 1227 | if map.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().40 { |
| 1228 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().( |
| 1229 | AdditionalPropertiesWithPatternsNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#::<SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap#, R> { |
| 1230 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&kctx, kctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema))), |
| 1231 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compile_small_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_small_map().(ctx, map)), |
| 1232 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns., |
| 1233 | }, |
| 1234 | ))) |
| 1235 | } else { |
| 1236 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().( |
| 1237 | AdditionalPropertiesWithPatternsNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#::<BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap#, R> { |
| 1238 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#node.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().(&kctx, kctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema))), |
| 1239 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#properties.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compile_big_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_big_map().(ctx, map)), |
| 1240 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyValidator#patterns., |
| 1241 | }, |
| 1242 | ))) |
| 1243 | } |
| 1244 | } |
| 1245 | |
| 1246 | fn compile_pattern_non_empty_falserust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile_pattern_non_empty_false().<'a, R>( |
| 1247 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 1248 | map: &'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#>, |
| 1249 | patterns: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(R, SchemaNoderust-analyzer cargo jsonschema 0.37.4 node/SchemaNode#)>, |
| 1250 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a>> |
| 1251 | where |
| 1252 | R: RegexEnginerust-analyzer cargo jsonschema 0.37.4 regex/RegexEngine# + 'static, |
| 1253 | { |
| 1254 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 1255 | if map.lenrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().40 { |
| 1256 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().( |
| 1257 | AdditionalPropertiesWithPatternsNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#::<SmallValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/SmallValidatorsMap#, R> { |
| 1258 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compile_small_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_small_map().(ctx, map)), |
| 1259 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns., |
| 1260 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#location.: kctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 1261 | }, |
| 1262 | ))) |
| 1263 | } else { |
| 1264 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().( |
| 1265 | AdditionalPropertiesWithPatternsNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#::<BigValidatorsMaprust-analyzer cargo jsonschema 0.37.4 properties/BigValidatorsMap#, R> { |
| 1266 | propertiesrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#properties.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compile_big_maprust-analyzer cargo jsonschema 0.37.4 properties/compile_big_map().(ctx, map)), |
| 1267 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#patterns., |
| 1268 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsNotEmptyFalseValidator#location.: kctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().clonerust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location][Clone]clone().(), |
| 1269 | }, |
| 1270 | ))) |
| 1271 | } |
| 1272 | } |
| 1273 | |
| 1274 | #[inline] |
| 1275 | pub(craterust-analyzer cargo jsonschema 0.37.4 crate/) fn compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile().<'a>( |
| 1276 | ctx: &compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::Contextrust-analyzer cargo jsonschema 0.37.4 compiler/Context#, |
| 1277 | 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#>, |
| 1278 | schema: &'a Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, |
| 1279 | ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CompilationResultrust-analyzer cargo jsonschema 0.37.4 keywords/CompilationResult#<'a>> { |
| 1280 | let properties = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("properties"); |
| 1281 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(patterns) = parent.getrust-analyzer cargo serde_json 1.0.145 map/impl#[`Map<String, Value>`]get().("patternProperties") { |
| 1282 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(obj) = patterns { |
| 1283 | // Compile all patterns & their validators to avoid doing work in the `patternProperties` validator |
| 1284 | match ctx.configrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]config().().pattern_optionsrust-analyzer cargo jsonschema 0.37.4 options/impl#[ValidationOptions]pattern_options().() { |
| 1285 | PatternEngineOptionsrust-analyzer cargo jsonschema 0.37.4 options/PatternEngineOptions#::FancyRegexrust-analyzer cargo jsonschema 0.37.4 options/PatternEngineOptions#FancyRegex# { .. } => { |
| 1286 | let patterns = match compile_fancy_regex_patternsrust-analyzer cargo jsonschema 0.37.4 properties/compile_fancy_regex_patterns().(ctx, obj) { |
| 1287 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(patterns) => patterns, |
| 1288 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error) => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error)), |
| 1289 | }; |
| 1290 | match schema { |
| 1291 | Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(true) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // "additionalProperties" are "true" by default |
| 1292 | Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(false) => { |
| 1293 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(properties) = properties { |
| 1294 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map) = properties { |
| 1295 | compile_pattern_non_empty_falserust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile_pattern_non_empty_false().::<fancy_regexrust-analyzer cargo fancy-regex 0.11.0 crate/::Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#>( |
| 1296 | ctx, map, patterns, |
| 1297 | ) |
| 1298 | } else { |
| 1299 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::customrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]custom().( |
| 1300 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1301 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1302 | properties, |
| 1303 | "Unexpected type", |
| 1304 | ))) |
| 1305 | } |
| 1306 | } else { |
| 1307 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().( |
| 1308 | AdditionalPropertiesWithPatternsFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator# { |
| 1309 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns., |
| 1310 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#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().("additionalProperties"), |
| 1311 | pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_path.: ctx |
| 1312 | .locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().() |
| 1313 | .joinrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]join().("patternProperties"), |
| 1314 | pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_absolute_location.: ctx |
| 1315 | .new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties") |
| 1316 | .base_urirust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]base_uri().(), |
| 1317 | }, |
| 1318 | ))) |
| 1319 | } |
| 1320 | } |
| 1321 | _ => { |
| 1322 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(properties) = properties { |
| 1323 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map) = properties { |
| 1324 | compile_pattern_non_emptyrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile_pattern_non_empty().::<fancy_regexrust-analyzer cargo fancy-regex 0.11.0 crate/::Regexrust-analyzer cargo fancy-regex 0.11.0 Regex#>( |
| 1325 | ctx, map, patterns, schema, |
| 1326 | ) |
| 1327 | } else { |
| 1328 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::customrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]custom().( |
| 1329 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1330 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1331 | properties, |
| 1332 | "Unexpected type", |
| 1333 | ))) |
| 1334 | } |
| 1335 | } else { |
| 1336 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 1337 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(AdditionalPropertiesWithPatternsValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator# { |
| 1338 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().( |
| 1339 | &kctx, |
| 1340 | kctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema), |
| 1341 | )), |
| 1342 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns., |
| 1343 | pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_path.: ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().joinrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]join().("patternProperties"), |
| 1344 | pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_absolute_location.: ctx |
| 1345 | .new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties") |
| 1346 | .base_urirust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]base_uri().(), |
| 1347 | }))) |
| 1348 | } |
| 1349 | } |
| 1350 | } |
| 1351 | } |
| 1352 | PatternEngineOptionsrust-analyzer cargo jsonschema 0.37.4 options/PatternEngineOptions#::Regexrust-analyzer cargo jsonschema 0.37.4 options/PatternEngineOptions#Regex# { .. } => { |
| 1353 | let patterns = match compile_regex_patternsrust-analyzer cargo jsonschema 0.37.4 properties/compile_regex_patterns().(ctx, obj) { |
| 1354 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(patterns) => patterns, |
| 1355 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error) => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error)), |
| 1356 | }; |
| 1357 | match schema { |
| 1358 | Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(true) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // "additionalProperties" are "true" by default |
| 1359 | Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(false) => { |
| 1360 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(properties) = properties { |
| 1361 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map) = properties { |
| 1362 | compile_pattern_non_empty_falserust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile_pattern_non_empty_false().::<regexrust-analyzer cargo regex 1.12.2 crate/::Regexrust-analyzer cargo regex 1.12.2 regex/string/Regex#>( |
| 1363 | ctx, map, patterns, |
| 1364 | ) |
| 1365 | } else { |
| 1366 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::customrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]custom().( |
| 1367 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1368 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1369 | properties, |
| 1370 | "Unexpected type", |
| 1371 | ))) |
| 1372 | } |
| 1373 | } else { |
| 1374 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().( |
| 1375 | AdditionalPropertiesWithPatternsFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator# { |
| 1376 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#patterns., |
| 1377 | locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#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().("additionalProperties"), |
| 1378 | pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_path.: ctx |
| 1379 | .locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().() |
| 1380 | .joinrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]join().("patternProperties"), |
| 1381 | pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsFalseValidator#pattern_keyword_absolute_location.: ctx |
| 1382 | .new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties") |
| 1383 | .base_urirust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]base_uri().(), |
| 1384 | }, |
| 1385 | ))) |
| 1386 | } |
| 1387 | } |
| 1388 | _ => { |
| 1389 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(properties) = properties { |
| 1390 | if let Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Objectrust-analyzer cargo serde_json 1.0.145 value/Value#Object#(map) = properties { |
| 1391 | compile_pattern_non_emptyrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/compile_pattern_non_empty().::<regexrust-analyzer cargo regex 1.12.2 crate/::Regexrust-analyzer cargo regex 1.12.2 regex/string/Regex#>( |
| 1392 | ctx, map, patterns, schema, |
| 1393 | ) |
| 1394 | } else { |
| 1395 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::customrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]custom().( |
| 1396 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1397 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1398 | properties, |
| 1399 | "Unexpected type", |
| 1400 | ))) |
| 1401 | } |
| 1402 | } else { |
| 1403 | let kctx = ctx.new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("additionalProperties"); |
| 1404 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(AdditionalPropertiesWithPatternsValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator# { |
| 1405 | noderust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#node.: try_compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/try_compile!!(compilerrust-analyzer cargo jsonschema 0.37.4 compiler/::compilerust-analyzer cargo jsonschema 0.37.4 compiler/compile().( |
| 1406 | &kctx, |
| 1407 | kctx.as_resource_refrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]as_resource_ref().(schema), |
| 1408 | )), |
| 1409 | patternsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#patterns., |
| 1410 | pattern_keyword_pathrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_path.: ctx.locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]location().().joinrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]join().("patternProperties"), |
| 1411 | pattern_keyword_absolute_locationrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesWithPatternsValidator#pattern_keyword_absolute_location.: ctx |
| 1412 | .new_at_locationrust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]new_at_location().("patternProperties") |
| 1413 | .base_urirust-analyzer cargo jsonschema 0.37.4 compiler/impl#[`Context<'a>`]base_uri().(), |
| 1414 | }))) |
| 1415 | } |
| 1416 | } |
| 1417 | } |
| 1418 | } |
| 1419 | } |
| 1420 | } else { |
| 1421 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ValidationErrorrust-analyzer cargo jsonschema 0.37.4 error/ValidationError#::single_type_errorrust-analyzer cargo jsonschema 0.37.4 error/impl#[`ValidationError<'a>`]single_type_error().( |
| 1422 | Locationrust-analyzer cargo jsonschema 0.37.4 paths/Location#::newrust-analyzer cargo jsonschema 0.37.4 paths/impl#[Location]new().(), |
| 1423 | 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().(), |
| 1424 | schema, |
| 1425 | JsonTyperust-analyzer cargo jsonschema 0.37.4 types/JsonType#::Objectrust-analyzer cargo jsonschema 0.37.4 types/JsonType#Object#, |
| 1426 | ))) |
| 1427 | } |
| 1428 | } else { |
| 1429 | match schema { |
| 1430 | Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(true) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // "additionalProperties" are "true" by default |
| 1431 | Valuerust-analyzer cargo serde_json 1.0.145 value/Value#::Boolrust-analyzer cargo serde_json 1.0.145 value/Value#Bool#(false) => { |
| 1432 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(properties) = properties { |
| 1433 | compile_dynamic_prop_map_validatorrust-analyzer cargo jsonschema 0.37.4 properties/compile_dynamic_prop_map_validator!!( |
| 1434 | AdditionalPropertiesNotEmptyFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyFalseValidator#, |
| 1435 | properties, |
| 1436 | ctx, |
| 1437 | ) |
| 1438 | } else { |
| 1439 | let 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().("additionalProperties"); |
| 1440 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(AdditionalPropertiesFalseValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesFalseValidator#::compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesFalseValidator]compile().(location)) |
| 1441 | } |
| 1442 | } |
| 1443 | _ => { |
| 1444 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(properties) = properties { |
| 1445 | compile_dynamic_prop_map_validatorrust-analyzer cargo jsonschema 0.37.4 properties/compile_dynamic_prop_map_validator!!( |
| 1446 | AdditionalPropertiesNotEmptyValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesNotEmptyValidator#, |
| 1447 | properties, |
| 1448 | ctx, |
| 1449 | schema, |
| 1450 | ) |
| 1451 | } else { |
| 1452 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(AdditionalPropertiesValidatorrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/AdditionalPropertiesValidator#::compilerust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/impl#[AdditionalPropertiesValidator]compile().(schema, ctx)) |
| 1453 | } |
| 1454 | } |
| 1455 | } |
| 1456 | } |
| 1457 | } |
| 1458 | |
| 1459 | #[cfg(test)] |
| 1460 | mod testsrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/ { |
| 1461 | use craterust-analyzer cargo jsonschema 0.37.4 crate/::tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/; |
| 1462 | use serde_jsonrust-analyzer cargo serde_json 1.0.145 crate/::{jsonrust-analyzer cargo serde_json 1.0.145 macros/json!, Valuerust-analyzer cargo serde_json 1.0.145 value/Value#}; |
| 1463 | use test_caserust-analyzer cargo test-case 3.3.1 crate/::test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:; |
| 1464 | |
| 1465 | fn schema_1rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_1().() -> Valuerust-analyzer cargo serde_json 1.0.145 value/Value# { |
| 1466 | // For `AdditionalPropertiesWithPatternsNotEmptyFalseValidator` |
| 1467 | jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({ |
| 1468 | "additionalProperties": false, |
| 1469 | "properties": { |
| 1470 | "foo": {"type": "string"}, |
| 1471 | "barbaz": {"type": "integer", "multipleOf": 3}, |
| 1472 | }, |
| 1473 | "patternProperties": { |
| 1474 | "^bar": {"type": "integer", "minimum": 5}, |
| 1475 | "spam$": {"type": "integer", "maximum": 10}, |
| 1476 | } |
| 1477 | }) |
| 1478 | } |
| 1479 | |
| 1480 | // Another type |
| 1481 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1]))] |
| 1482 | // The right type |
| 1483 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({}))] |
| 1484 | // Match `properties.foo` |
| 1485 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": "a"}))] |
| 1486 | // Match `properties.barbaz` & `patternProperties.^bar` |
| 1487 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barbaz": 6}))] |
| 1488 | // Match `patternProperties.^bar` |
| 1489 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6}))] |
| 1490 | // Match `patternProperties.spam$` |
| 1491 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 7}))] |
| 1492 | // All `patternProperties` rules match on different values |
| 1493 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 7}))] |
| 1494 | // All `patternProperties` rules match on the same value |
| 1495 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7}))] |
| 1496 | // All combined |
| 1497 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7, "bar": 6, "spam": 7, "foo": "a", "barbaz": 6}))] |
| 1498 | fn schema_1_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_1_valid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) { |
| 1499 | let schema = schema_1rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_1().(); |
| 1500 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_valid().(&schema, instance); |
| 1501 | } |
| 1502 | |
| 1503 | // `properties.foo` - should be a string |
| 1504 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": 3}), &["3 is not of type \"string\""], &["/properties/foo/type"])] |
| 1505 | // `additionalProperties` - extra keyword & not in `properties` / `patternProperties` |
| 1506 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": 1}), &["Additional properties are not allowed (\'faz\' was unexpected)"], &["/additionalProperties"])] |
| 1507 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": 1, "haz": 1}), &["Additional properties are not allowed (\'faz\', \'haz\' were unexpected)"], &["/additionalProperties"])] |
| 1508 | // `properties.foo` - should be a string & `patternProperties.^bar` - invalid |
| 1509 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": 3, "bar": 4}), &["4 is less than the minimum of 5", "3 is not of type \"string\""], &["/patternProperties/^bar/minimum", "/properties/foo/type"])] |
| 1510 | // `properties.barbaz` - valid; `patternProperties.^bar` - invalid |
| 1511 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barbaz": 3}), &["3 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1512 | // `patternProperties.^bar` (should be >=5) |
| 1513 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1514 | // `patternProperties.spam$` (should be <=10) |
| 1515 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1516 | // `patternProperties` - both values are invalid |
| 1517 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11}), &["4 is less than the minimum of 5", "11 is greater than the maximum of 10"], &["/patternProperties/^bar/minimum", "/patternProperties/spam$/maximum"])] |
| 1518 | // `patternProperties` - `bar` is valid, `spam` is invalid |
| 1519 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1520 | // `patternProperties` - `bar` is invalid, `spam` is valid |
| 1521 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 8}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1522 | // `patternProperties.^bar` - (should be >=5), but valid for `patternProperties.spam$` |
| 1523 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1524 | // `patternProperties.spam$` - (should be <=10), but valid for `patternProperties.^bar` |
| 1525 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1526 | // All combined |
| 1527 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:( |
| 1528 | &jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11, "foo": 3, "faz": 1}), |
| 1529 | &[ |
| 1530 | "4 is less than the minimum of 5", |
| 1531 | "3 is not of type \"string\"", |
| 1532 | "11 is greater than the maximum of 10", |
| 1533 | "Additional properties are not allowed (\'faz\' was unexpected)" |
| 1534 | ], |
| 1535 | &[ |
| 1536 | "/patternProperties/^bar/minimum", |
| 1537 | "/properties/foo/type", |
| 1538 | "/patternProperties/spam$/maximum", |
| 1539 | "/additionalProperties" |
| 1540 | ] |
| 1541 | )] |
| 1542 | fn schema_1_invalidrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_1_invalid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, expected: &[&str], locations: &[&str]) { |
| 1543 | let schema = schema_1rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_1().(); |
| 1544 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_not_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_not_valid().(&schema, instance); |
| 1545 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::expect_errorsrust-analyzer cargo jsonschema 0.37.4 tests_util/expect_errors().(&schema, instance, expected); |
| 1546 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::assert_locationsrust-analyzer cargo jsonschema 0.37.4 tests_util/assert_locations().(&schema, instance, locations); |
| 1547 | } |
| 1548 | |
| 1549 | fn schema_2rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_2().() -> Valuerust-analyzer cargo serde_json 1.0.145 value/Value# { |
| 1550 | // For `AdditionalPropertiesWithPatternsFalseValidator` |
| 1551 | jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({ |
| 1552 | "additionalProperties": false, |
| 1553 | "patternProperties": { |
| 1554 | "^bar": {"type": "integer", "minimum": 5}, |
| 1555 | "spam$": {"type": "integer", "maximum": 10}, |
| 1556 | } |
| 1557 | }) |
| 1558 | } |
| 1559 | |
| 1560 | // Another type |
| 1561 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1]))] |
| 1562 | // The right type |
| 1563 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({}))] |
| 1564 | // Match `patternProperties.^bar` |
| 1565 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6}))] |
| 1566 | // Match `patternProperties.spam$` |
| 1567 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 7}))] |
| 1568 | // All `patternProperties` rules match on different values |
| 1569 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 7}))] |
| 1570 | // All `patternProperties` rules match on the same value |
| 1571 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7}))] |
| 1572 | // All combined |
| 1573 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7, "bar": 6, "spam": 7}))] |
| 1574 | fn schema_2_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_2_valid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) { |
| 1575 | let schema = schema_2rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_2().(); |
| 1576 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_valid().(&schema, instance); |
| 1577 | } |
| 1578 | |
| 1579 | // `additionalProperties` - extra keyword & not in `patternProperties` |
| 1580 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": "a"}), &["Additional properties are not allowed (\'faz\' was unexpected)"], &["/additionalProperties"])] |
| 1581 | // `patternProperties.^bar` (should be >=5) |
| 1582 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1583 | // `patternProperties.spam$` (should be <=10) |
| 1584 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1585 | // `patternProperties` - both values are invalid |
| 1586 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11}), &["4 is less than the minimum of 5", "11 is greater than the maximum of 10"], &["/patternProperties/^bar/minimum", "/patternProperties/spam$/maximum"])] |
| 1587 | // `patternProperties` - `bar` is valid, `spam` is invalid |
| 1588 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1589 | // `patternProperties` - `bar` is invalid, `spam` is valid |
| 1590 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 8}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1591 | // `patternProperties.^bar` - (should be >=5), but valid for `patternProperties.spam$` |
| 1592 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1593 | // `patternProperties.spam$` - (should be <=10), but valid for `patternProperties.^bar` |
| 1594 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1595 | // All combined |
| 1596 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:( |
| 1597 | &jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11, "faz": 1}), |
| 1598 | &[ |
| 1599 | "4 is less than the minimum of 5", |
| 1600 | "11 is greater than the maximum of 10", |
| 1601 | "Additional properties are not allowed (\'faz\' was unexpected)" |
| 1602 | ], |
| 1603 | &[ |
| 1604 | "/patternProperties/^bar/minimum", |
| 1605 | "/patternProperties/spam$/maximum", |
| 1606 | "/additionalProperties" |
| 1607 | ] |
| 1608 | )] |
| 1609 | fn schema_2_invalidrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_2_invalid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, expected: &[&str], locations: &[&str]) { |
| 1610 | let schema = schema_2rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_2().(); |
| 1611 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_not_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_not_valid().(&schema, instance); |
| 1612 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::expect_errorsrust-analyzer cargo jsonschema 0.37.4 tests_util/expect_errors().(&schema, instance, expected); |
| 1613 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::assert_locationsrust-analyzer cargo jsonschema 0.37.4 tests_util/assert_locations().(&schema, instance, locations); |
| 1614 | } |
| 1615 | |
| 1616 | fn schema_3rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_3().() -> Valuerust-analyzer cargo serde_json 1.0.145 value/Value# { |
| 1617 | // For `AdditionalPropertiesNotEmptyFalseValidator` |
| 1618 | jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({ |
| 1619 | "additionalProperties": false, |
| 1620 | "properties": { |
| 1621 | "foo": {"type": "string"} |
| 1622 | } |
| 1623 | }) |
| 1624 | } |
| 1625 | |
| 1626 | // Another type |
| 1627 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1]))] |
| 1628 | // The right type |
| 1629 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({}))] |
| 1630 | // Match `properties` |
| 1631 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": "a"}))] |
| 1632 | fn schema_3_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_3_valid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) { |
| 1633 | let schema = schema_3rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_3().(); |
| 1634 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_valid().(&schema, instance); |
| 1635 | } |
| 1636 | |
| 1637 | // `properties` - should be a string |
| 1638 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": 3}), &["3 is not of type \"string\""], &["/properties/foo/type"])] |
| 1639 | // `additionalProperties` - extra keyword & not in `properties` |
| 1640 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": "a"}), &["Additional properties are not allowed (\'faz\' was unexpected)"], &["/additionalProperties"])] |
| 1641 | // All combined |
| 1642 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:( |
| 1643 | &jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!( |
| 1644 | {"foo": 3, "faz": "a"}), |
| 1645 | &[ |
| 1646 | "3 is not of type \"string\"", |
| 1647 | "Additional properties are not allowed (\'faz\' was unexpected)", |
| 1648 | ], |
| 1649 | &[ |
| 1650 | "/properties/foo/type", |
| 1651 | "/additionalProperties", |
| 1652 | ] |
| 1653 | )] |
| 1654 | fn schema_3_invalidrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_3_invalid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, expected: &[&str], locations: &[&str]) { |
| 1655 | let schema = schema_3rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_3().(); |
| 1656 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_not_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_not_valid().(&schema, instance); |
| 1657 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::expect_errorsrust-analyzer cargo jsonschema 0.37.4 tests_util/expect_errors().(&schema, instance, expected); |
| 1658 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::assert_locationsrust-analyzer cargo jsonschema 0.37.4 tests_util/assert_locations().(&schema, instance, locations); |
| 1659 | } |
| 1660 | |
| 1661 | fn schema_4rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_4().() -> Valuerust-analyzer cargo serde_json 1.0.145 value/Value# { |
| 1662 | // For `AdditionalPropertiesNotEmptyValidator` |
| 1663 | jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({ |
| 1664 | "additionalProperties": {"type": "integer"}, |
| 1665 | "properties": { |
| 1666 | "foo": {"type": "string"} |
| 1667 | } |
| 1668 | }) |
| 1669 | } |
| 1670 | |
| 1671 | // Another type |
| 1672 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1]))] |
| 1673 | // The right type |
| 1674 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({}))] |
| 1675 | // Match `properties` |
| 1676 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": "a"}))] |
| 1677 | // Match `additionalProperties` |
| 1678 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4}))] |
| 1679 | // All combined |
| 1680 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": "a", "bar": 4}))] |
| 1681 | fn schema_4_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_4_valid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) { |
| 1682 | let schema = schema_4rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_4().(); |
| 1683 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_valid().(&schema, instance); |
| 1684 | } |
| 1685 | |
| 1686 | // `properties` - should be a string |
| 1687 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": 3}), &["3 is not of type \"string\""], &["/properties/foo/type"])] |
| 1688 | // `additionalProperties` - should be an integer |
| 1689 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": "a"}), &["\"a\" is not of type \"integer\""], &["/additionalProperties/type"])] |
| 1690 | // All combined |
| 1691 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:( |
| 1692 | &jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!( |
| 1693 | {"foo": 3, "bar": "a"}), |
| 1694 | &[ |
| 1695 | "\"a\" is not of type \"integer\"", |
| 1696 | "3 is not of type \"string\"" |
| 1697 | ], |
| 1698 | &[ |
| 1699 | "/additionalProperties/type", |
| 1700 | "/properties/foo/type", |
| 1701 | ] |
| 1702 | )] |
| 1703 | fn schema_4_invalidrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_4_invalid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, expected: &[&str], locations: &[&str]) { |
| 1704 | let schema = schema_4rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_4().(); |
| 1705 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_not_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_not_valid().(&schema, instance); |
| 1706 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::expect_errorsrust-analyzer cargo jsonschema 0.37.4 tests_util/expect_errors().(&schema, instance, expected); |
| 1707 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::assert_locationsrust-analyzer cargo jsonschema 0.37.4 tests_util/assert_locations().(&schema, instance, locations); |
| 1708 | } |
| 1709 | |
| 1710 | fn schema_5rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_5().() -> Valuerust-analyzer cargo serde_json 1.0.145 value/Value# { |
| 1711 | // For `AdditionalPropertiesWithPatternsNotEmptyValidator` |
| 1712 | jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({ |
| 1713 | "additionalProperties": {"type": "integer"}, |
| 1714 | "properties": { |
| 1715 | "foo": {"type": "string"}, |
| 1716 | "barbaz": {"type": "integer", "multipleOf": 3}, |
| 1717 | }, |
| 1718 | "patternProperties": { |
| 1719 | "^bar": {"type": "integer", "minimum": 5}, |
| 1720 | "spam$": {"type": "integer", "maximum": 10}, |
| 1721 | } |
| 1722 | }) |
| 1723 | } |
| 1724 | |
| 1725 | // Another type |
| 1726 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1]))] |
| 1727 | // The right type |
| 1728 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({}))] |
| 1729 | // Match `properties.foo` |
| 1730 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": "a"}))] |
| 1731 | // Match `additionalProperties` |
| 1732 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": 42}))] |
| 1733 | // Match `properties.barbaz` & `patternProperties.^bar` |
| 1734 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barbaz": 6}))] |
| 1735 | // Match `patternProperties.^bar` |
| 1736 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6}))] |
| 1737 | // Match `patternProperties.spam$` |
| 1738 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 7}))] |
| 1739 | // All `patternProperties` rules match on different values |
| 1740 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 7}))] |
| 1741 | // All `patternProperties` rules match on the same value |
| 1742 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7}))] |
| 1743 | // All combined |
| 1744 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7, "bar": 6, "spam": 7, "foo": "a", "barbaz": 6, "faz": 42}))] |
| 1745 | fn schema_5_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_5_valid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) { |
| 1746 | let schema = schema_5rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_5().(); |
| 1747 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_valid().(&schema, instance); |
| 1748 | } |
| 1749 | |
| 1750 | // `properties.bar` - should be a string |
| 1751 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": 3}), &["3 is not of type \"string\""], &["/properties/foo/type"])] |
| 1752 | // `additionalProperties` - extra keyword that doesn't match `additionalProperties` |
| 1753 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": "a"}), &["\"a\" is not of type \"integer\""], &["/additionalProperties/type"])] |
| 1754 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": "a", "haz": "a"}), &["\"a\" is not of type \"integer\"", "\"a\" is not of type \"integer\""], &["/additionalProperties/type", "/additionalProperties/type"])] |
| 1755 | // `properties.foo` - should be a string & `patternProperties.^bar` - invalid |
| 1756 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": 3, "bar": 4}), &["4 is less than the minimum of 5", "3 is not of type \"string\""], &["/patternProperties/^bar/minimum", "/properties/foo/type"])] |
| 1757 | // `properties.barbaz` - valid; `patternProperties.^bar` - invalid |
| 1758 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barbaz": 3}), &["3 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1759 | // `patternProperties.^bar` (should be >=5) |
| 1760 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1761 | // `patternProperties.spam$` (should be <=10) |
| 1762 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1763 | // `patternProperties` - both values are invalid |
| 1764 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11}), &["4 is less than the minimum of 5", "11 is greater than the maximum of 10"], &["/patternProperties/^bar/minimum", "/patternProperties/spam$/maximum"])] |
| 1765 | // `patternProperties` - `bar` is valid, `spam` is invalid |
| 1766 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1767 | // `patternProperties` - `bar` is invalid, `spam` is valid |
| 1768 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 8}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1769 | // `patternProperties.^bar` - (should be >=5), but valid for `patternProperties.spam$` |
| 1770 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1771 | // `patternProperties.spam$` - (should be <=10), but valid for `patternProperties.^bar` |
| 1772 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1773 | // All combined + valid via `additionalProperties` |
| 1774 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:( |
| 1775 | &jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11, "foo": 3, "faz": "a", "fam": 42}), |
| 1776 | &[ |
| 1777 | "4 is less than the minimum of 5", |
| 1778 | "\"a\" is not of type \"integer\"", |
| 1779 | "3 is not of type \"string\"", |
| 1780 | "11 is greater than the maximum of 10", |
| 1781 | ], |
| 1782 | &[ |
| 1783 | "/patternProperties/^bar/minimum", |
| 1784 | "/additionalProperties/type", |
| 1785 | "/properties/foo/type", |
| 1786 | "/patternProperties/spam$/maximum", |
| 1787 | ] |
| 1788 | )] |
| 1789 | fn schema_5_invalidrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_5_invalid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, expected: &[&str], locations: &[&str]) { |
| 1790 | let schema = schema_5rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_5().(); |
| 1791 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_not_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_not_valid().(&schema, instance); |
| 1792 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::expect_errorsrust-analyzer cargo jsonschema 0.37.4 tests_util/expect_errors().(&schema, instance, expected); |
| 1793 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::assert_locationsrust-analyzer cargo jsonschema 0.37.4 tests_util/assert_locations().(&schema, instance, locations); |
| 1794 | } |
| 1795 | |
| 1796 | fn schema_6rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_6().() -> Valuerust-analyzer cargo serde_json 1.0.145 value/Value# { |
| 1797 | // For `AdditionalPropertiesWithPatternsValidator` |
| 1798 | jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({ |
| 1799 | "additionalProperties": {"type": "integer"}, |
| 1800 | "patternProperties": { |
| 1801 | "^bar": {"type": "integer", "minimum": 5}, |
| 1802 | "spam$": {"type": "integer", "maximum": 10}, |
| 1803 | } |
| 1804 | }) |
| 1805 | } |
| 1806 | |
| 1807 | // Another type |
| 1808 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!([1]))] |
| 1809 | // The right type |
| 1810 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({}))] |
| 1811 | // Match `additionalProperties` |
| 1812 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": 42}))] |
| 1813 | // Match `patternProperties.^bar` |
| 1814 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6}))] |
| 1815 | // Match `patternProperties.spam$` |
| 1816 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 7}))] |
| 1817 | // All `patternProperties` rules match on different values |
| 1818 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 7}))] |
| 1819 | // All `patternProperties` rules match on the same value |
| 1820 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7}))] |
| 1821 | // All combined |
| 1822 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 7, "bar": 6, "spam": 7, "faz": 42}))] |
| 1823 | fn schema_6_validrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_6_valid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#) { |
| 1824 | let schema = schema_6rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_6().(); |
| 1825 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_valid().(&schema, instance); |
| 1826 | } |
| 1827 | |
| 1828 | // `additionalProperties` - extra keyword that doesn't match `additionalProperties` |
| 1829 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": "a"}), &["\"a\" is not of type \"integer\""], &["/additionalProperties/type"])] |
| 1830 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"faz": "a", "haz": "a"}), &["\"a\" is not of type \"integer\"", "\"a\" is not of type \"integer\""], &["/additionalProperties/type", "/additionalProperties/type"])] |
| 1831 | // `additionalProperties` - should be an integer & `patternProperties.^bar` - invalid |
| 1832 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"foo": "a", "bar": 4}), &["4 is less than the minimum of 5", "\"a\" is not of type \"integer\""], &["/patternProperties/^bar/minimum", "/additionalProperties/type"])] |
| 1833 | // `patternProperties.^bar` (should be >=5) |
| 1834 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1835 | // `patternProperties.spam$` (should be <=10) |
| 1836 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1837 | // `patternProperties` - both values are invalid |
| 1838 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11}), &["4 is less than the minimum of 5", "11 is greater than the maximum of 10"], &["/patternProperties/^bar/minimum", "/patternProperties/spam$/maximum"])] |
| 1839 | // `patternProperties` - `bar` is valid, `spam` is invalid |
| 1840 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 6, "spam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1841 | // `patternProperties` - `bar` is invalid, `spam` is valid |
| 1842 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 8}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1843 | // `patternProperties.^bar` - (should be >=5), but valid for `patternProperties.spam$` |
| 1844 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 4}), &["4 is less than the minimum of 5"], &["/patternProperties/^bar/minimum"])] |
| 1845 | // `patternProperties.spam$` - (should be <=10), but valid for `patternProperties.^bar` |
| 1846 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:(&jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"barspam": 11}), &["11 is greater than the maximum of 10"], &["/patternProperties/spam$/maximum"])] |
| 1847 | // All combined + valid via `additionalProperties` |
| 1848 | #[test_caserust-analyzer cargo test-case-macros 3.3.1 test_case:( |
| 1849 | &jsonrust-analyzer cargo serde_json 1.0.145 macros/json!!({"bar": 4, "spam": 11, "faz": "a", "fam": 42}), |
| 1850 | &[ |
| 1851 | "4 is less than the minimum of 5", |
| 1852 | "\"a\" is not of type \"integer\"", |
| 1853 | "11 is greater than the maximum of 10", |
| 1854 | ], |
| 1855 | &[ |
| 1856 | "/patternProperties/^bar/minimum", |
| 1857 | "/additionalProperties/type", |
| 1858 | "/patternProperties/spam$/maximum", |
| 1859 | ] |
| 1860 | )] |
| 1861 | fn schema_6_invalidrust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_6_invalid().(instance: &Valuerust-analyzer cargo serde_json 1.0.145 value/Value#, expected: &[&str], locations: &[&str]) { |
| 1862 | let schema = schema_6rust-analyzer cargo jsonschema 0.37.4 keywords/additional_properties/tests/schema_6().(); |
| 1863 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::is_not_validrust-analyzer cargo jsonschema 0.37.4 tests_util/is_not_valid().(&schema, instance); |
| 1864 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::expect_errorsrust-analyzer cargo jsonschema 0.37.4 tests_util/expect_errors().(&schema, instance, expected); |
| 1865 | tests_utilrust-analyzer cargo jsonschema 0.37.4 tests_util/::assert_locationsrust-analyzer cargo jsonschema 0.37.4 tests_util/assert_locations().(&schema, instance, locations); |
| 1866 | } |
| 1867 | } |