File tree 2 files changed +12
-1
lines changed 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class SchemaKey:
49
49
ref = "$ref"
50
50
items = "items"
51
51
properties = "properties"
52
+ pattern_properties = "patternProperties"
52
53
53
54
class Error :
54
55
def __init__ (self , path , data , schema = None ):
@@ -292,6 +293,10 @@ def _resolve_schema_references(schema, resolver):
292
293
for k , val in schema [SchemaKey .properties ].items ():
293
294
schema [SchemaKey .properties ][k ] = _resolve_schema_references (val , resolver )
294
295
296
+ if SchemaKey .pattern_properties in schema :
297
+ for k , val in schema [SchemaKey .pattern_properties ].items ():
298
+ schema [SchemaKey .pattern_properties ][k ] = _resolve_schema_references (val , resolver )
299
+
295
300
if SchemaKey .items in schema :
296
301
schema [SchemaKey .items ] = _resolve_schema_references (schema [SchemaKey .items ], resolver )
297
302
Original file line number Diff line number Diff line change @@ -233,14 +233,20 @@ def test_internal_refs_resolve(self):
233
233
result = resolve_schema_references (schema )
234
234
self .assertEqual (result ['properties' ]['name' ]['type' ], "string" )
235
235
236
-
237
236
def test_external_refs_resolve (self ):
238
237
schema = {"type" : "object" ,
239
238
"properties" : { "name" : {"$ref" : "references.json#/definitions/string_type" }}}
240
239
refs = {"references.json" : {"definitions" : { "string_type" : {"type" : "string" }}}}
241
240
result = resolve_schema_references (schema , refs )
242
241
self .assertEqual (result ['properties' ]['name' ]['type' ], "string" )
243
242
243
+ def test_refs_resolve_pattern_properties (self ):
244
+ schema = {"type" : "object" ,
245
+ "definitions" : { "string_type" : {"type" : "string" }},
246
+ "patternProperties" : {".+" : {"$ref" : "#/definitions/string_type" }}}
247
+ result = resolve_schema_references (schema )
248
+ self .assertEqual (result ["patternProperties" ][".+" ]["type" ], "string" )
249
+
244
250
def test_refs_resolve_items (self ):
245
251
schema = {"type" : "object" ,
246
252
"properties" : { "dogs" :
You can’t perform that action at this time.
0 commit comments