From 4d55775bdca9149e8161b0693a0ac4d9dbd6b53e Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 10 Oct 2023 10:39:04 -0700 Subject: [PATCH] Set to Py27Dict if components is explicitly set to None --- samtranslator/open_api/open_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samtranslator/open_api/open_api.py b/samtranslator/open_api/open_api.py index 0eb18bae3..1ccfa438b 100644 --- a/samtranslator/open_api/open_api.py +++ b/samtranslator/open_api/open_api.py @@ -518,6 +518,10 @@ def openapi(self) -> Dict[str, Any]: if self.security_schemes: self._doc.setdefault("components", Py27Dict()) + if not self._doc["components"]: + # explicitly set to dict to account for scenario where + # 'components' is explicitly set to None + self._doc["components"] = Py27Dict() self._doc["components"]["securitySchemes"] = self.security_schemes if self.info: