From 2a2721c7657651e55104f4d78b985809cd8fc202 Mon Sep 17 00:00:00 2001 From: Daisie Huang Date: Wed, 29 Nov 2023 10:15:10 -0800 Subject: [PATCH] check to make sure there's a $ref --- schema.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/schema.py b/schema.py index a74b615..afa80c9 100644 --- a/schema.py +++ b/schema.py @@ -136,8 +136,10 @@ def fail(self, message): def expand_ref(self, ref): - refName = ref["$ref"].replace("#/components/schemas/", "") - return self.generate_schema_scaffold(json.loads(json.dumps(self.schema[refName]))) + if "$ref" in ref: + refName = ref["$ref"].replace("#/components/schemas/", "") + return self.generate_schema_scaffold(json.loads(json.dumps(self.schema[refName]))) + return ref["type"] def generate_schema_scaffold(self, schema_obj):