This repository was archived by the owner on Aug 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import pytest
66
77import typesystem
8- from typesystem .json_schema import from_json_schema , to_json_schema , JSONSchema
8+ from typesystem .json_schema import JSONSchema , from_json_schema , to_json_schema
99
1010filenames = [
1111 "additionalItems.json" ,
Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ def from_json_schema(
116116 if definitions is None :
117117 definitions = SchemaDefinitions ()
118118 for key , value in data .get ("definitions" , {}).items ():
119- definitions [key ] = from_json_schema (value , definitions = definitions )
119+ ref = f"#/definitions/{ key } "
120+ definitions [ref ] = from_json_schema (value , definitions = definitions )
120121
121122 if "$ref" in data :
122123 return ref_from_json_schema (data , definitions = definitions )
@@ -334,11 +335,8 @@ def from_json_schema_type(
334335
335336def ref_from_json_schema (data : dict , definitions : SchemaDefinitions ) -> Field :
336337 reference_string = data ["$ref" ]
337- assert reference_string .startswith (
338- "#/definitions/"
339- ), "Unsupported $ref style in document."
340- name = reference_string [len ("#/definitions/" ) :]
341- return Reference (to = name , definitions = definitions )
338+ assert reference_string .startswith ("#/" ), "Unsupported $ref style in document."
339+ return Reference (to = reference_string , definitions = definitions )
342340
343341
344342def enum_from_json_schema (data : dict , definitions : SchemaDefinitions ) -> Field :
You can’t perform that action at this time.
0 commit comments