fix: return copy of schema without 'definitions' key

Instead of delete key 'definitions' from schema, bc schema was "cached" and if you try to load swagger twice, you got "no definitions" exception
This commit is contained in:
jar3b 2020-11-25 01:55:01 +03:00
parent 67a95ec9c9
commit 5567d73952

View File

@ -55,9 +55,8 @@ class _OASResponseBuilder:
if 'definitions' in schema: if 'definitions' in schema:
for k, v in schema['definitions'].items(): for k, v in schema['definitions'].items():
self._definitions[k] = v self._definitions[k] = v
del schema['definitions']
return schema return {i:schema[i] for i in schema if i!='definitions'}
def _handle_pydantic_base_model(self, obj): def _handle_pydantic_base_model(self, obj):
if is_pydantic_base_model(obj): if is_pydantic_base_model(obj):