Skip to content

Commit

Permalink
Set to Py27Dict if components is explicitly set to None
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinZZ committed Oct 10, 2023
1 parent 9074ad0 commit 4d55775
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions samtranslator/open_api/open_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4d55775

Please sign in to comment.