From 5567d739520e68f7eaeb6c8d819b0b826b17c759 Mon Sep 17 00:00:00 2001 From: jar3b Date: Wed, 25 Nov 2020 01:55:01 +0300 Subject: [PATCH] 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 --- aiohttp_pydantic/oas/view.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aiohttp_pydantic/oas/view.py b/aiohttp_pydantic/oas/view.py index cb89ee1..8523391 100644 --- a/aiohttp_pydantic/oas/view.py +++ b/aiohttp_pydantic/oas/view.py @@ -55,9 +55,8 @@ class _OASResponseBuilder: if 'definitions' in schema: for k, v in schema['definitions'].items(): 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): if is_pydantic_base_model(obj):