Skip to content

Commit b5a0b8e

Browse files
GavinZZaaythapa
andauthored
fix: Set to Py27Dict if components is explicitly set to None (#3373)
Co-authored-by: Aayush thapa <[email protected]>
1 parent 7bf59dd commit b5a0b8e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

samtranslator/open_api/open_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ def openapi(self) -> Dict[str, Any]:
518518

519519
if self.security_schemes:
520520
self._doc.setdefault("components", Py27Dict())
521+
if not self._doc["components"]:
522+
# explicitly set to dict to account for scenario where
523+
# 'components' is explicitly set to None
524+
self._doc["components"] = Py27Dict()
521525
self._doc["components"]["securitySchemes"] = self.security_schemes
522526

523527
if self.info:

0 commit comments

Comments
 (0)