diff --git a/data/api/server-server/transactions.yaml b/data/api/server-server/transactions.yaml index 46dd17afd..4bd2e59c2 100644 --- a/data/api/server-server/transactions.yaml +++ b/data/api/server-server/transactions.yaml @@ -69,7 +69,7 @@ paths: $ref: "definitions/edu.yaml" example: { "$ref": "examples/transaction.json", - "edus": [{"$ref": "edu.json"}] # Relative to the examples directory + "edus": [{"$ref": "examples/edu.json"}] # Relative to the examples directory } responses: 200: diff --git a/scripts/dump-swagger.py b/scripts/dump-swagger.py index 31004f733..e536ea858 100755 --- a/scripts/dump-swagger.py +++ b/scripts/dump-swagger.py @@ -37,11 +37,18 @@ def resolve_references(path, schema): # do $ref first if '$ref' in schema: value = schema['$ref'] + previous_path = path path = os.path.join(os.path.dirname(path), value) - with open(path, encoding="utf-8") as f: - ref = yaml.safe_load(f) - result = resolve_references(path, ref) - del schema['$ref'] + try: + with open(path, encoding="utf-8") as f: + ref = yaml.safe_load(f) + result = resolve_references(path, ref) + del schema['$ref'] + path = previous_path + except FileNotFoundError: + print("Resolving {}".format(schema)) + print("File not found: {}".format(path)) + result = {} else: result = {}