@@ -206,42 +206,25 @@ def normalizator(
206206 validators parameter for detailed description.
207207 :
208208 """
209- # Very first step is to expand references in the schema itself:
209+ # Very first step is to expand $refs in the schema itself:
210210 expand_refs (schema )
211211
212- # Now we can expand references in the property value:
212+ # Now we can expand $refs in the property value:
213213 if isinstance (property_value , dict ):
214214 expand_refs (property_value )
215215
216- # Now we can validate the entries:
217-
218- # TODO: Delete all the below commented-out code if tests pass (simplified above)
219- # resolver_registry: Registry = get_ref_resolver_registry(schema)
220- # ref_resolver: Resolver = resolver_registry.resolver()
221-
222- # def resolve(subschema: dict[str, Any]) -> dict[str, Any]:
223- # if "$ref" in subschema:
224- # try:
225- # resolved = ref_resolver.lookup(subschema["$ref"]).contents
226- # except Unresolvable as e:
227- # raise ValidationError(
228- # f"Failed to resolve $ref '{subschema['$ref']}' from {ref_resolver!r} and schema {schema!r}: {e}"
229- # ) from e
230- # return cast(dict[str, Any], resolved)
231- # return subschema
216+ # Now we can validate and normalize the values:
232217
233218 # Transform object and array values before running json schema type checking for each element.
234219 # Recursively normalize every value of the "instance" sub-object,
235220 # if "instance" is an incorrect type - skip recursive normalization of "instance"
236221 if schema_key == "properties" and isinstance (instance , dict ):
237222 for k , subschema in property_value .items ():
238223 if k in instance :
239- # subschema = resolve(subschema)
240224 instance [k ] = self .__normalize (instance [k ], subschema )
241225 # Recursively normalize every item of the "instance" sub-array,
242226 # if "instance" is an incorrect type - skip recursive normalization of "instance"
243227 elif schema_key == "items" and isinstance (instance , list ):
244- # subschema = resolve(property_value)
245228 for index , item in enumerate (instance ):
246229 instance [index ] = self .__normalize (item , property_value )
247230
0 commit comments