Skip to content

Commit

Permalink
Solution for issue #311
Browse files Browse the repository at this point in the history
Sorry for all changes, but it pretend to solve the issue #311 I loaded the main_def from file
  • Loading branch information
isaacfi committed Jun 24, 2019
1 parent 0ee67a7 commit bf262df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions flasgger/utils.py
Expand Up @@ -358,6 +358,15 @@ def validate(

if validation_function is None:
validation_function = jsonschema.validate

if '$ref' in main_def:
file_ref_path = os.path.dirname(sys.argv[0])+main_def['$ref']
with open(file_ref_path) as file:
file_content = file.read()
comment_index = file_content.index('---')+3
main_def = yaml.safe_load(
(file_content[comment_index:]).replace('\n', '\n '))
main_def['definitions'] = definitions

try:
validation_function(data, main_def)
Expand Down

0 comments on commit bf262df

Please sign in to comment.