@@ -868,7 +868,7 @@ def resolve_remote(self, uri):
868
868
self .store [uri ] = result
869
869
return result
870
870
871
- def store_subschema (self , schema , last_schema = None , last_url = None ):
871
+ def store_subschema (self , schema , last_url = None ):
872
872
"""
873
873
Using $id or id with $ref, save subschema to self.store
874
874
@@ -878,32 +878,30 @@ def store_subschema(self, schema, last_schema=None, last_url=None):
878
878
879
879
The referring schema.
880
880
881
- last_schema:
882
-
883
- The referring upper level schema.
884
-
885
881
last_url:
886
882
887
- Save the last URL .
883
+ The last url .
888
884
"""
889
885
if not isinstance (schema , dict ) \
890
886
or self .resolution_scope in list_schema :
891
887
return
892
888
893
889
for k in schema .keys ():
894
890
if k in [u"id" , u"$id" ] and isinstance (schema [k ], str_types ):
895
-
891
+ #Splicing the url in the last id with the url in this id,
892
+ #and store last_url at the same time.
896
893
last_url = urljoin (last_url , schema [k ], allow_fragments = True )
897
894
url , fragment = urldefrag (last_url )
898
895
899
- if last_schema :
900
- self .store [url ] = copy .deepcopy (last_schema )
896
+ #Save the schema into self.store[url]
897
+ self .store [url ] = copy .deepcopy (schema )
901
898
899
+ #Add fragment element in self.store[url]
902
900
if fragment :
903
901
self .store [url ][fragment ] = copy .deepcopy (schema )
904
902
905
903
if isinstance (schema [k ], dict ):
906
- self .store_subschema (schema [k ], schema , last_url )
904
+ self .store_subschema (schema [k ], last_url )
907
905
908
906
909
907
def validate (instance , schema , cls = None , * args , ** kwargs ):
0 commit comments