Skip to content

Commit

Permalink
create a static string for feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
xazhao committed Mar 4, 2024
1 parent 6a7a89f commit 7e891c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion samtranslator/model/api/api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

LOG = logging.getLogger(__name__)

FEATURE_FLAG_NORMALIZED_OPENAPI_VERSION = "normalized_open_api_version"

_CORS_WILDCARD = "'*'"
CorsProperties = namedtuple(
"CorsProperties", ["AllowMethods", "AllowHeaders", "AllowOrigin", "MaxAge", "AllowCredentials"]
Expand Down Expand Up @@ -1127,7 +1129,7 @@ def _openapi_postprocess(self, definition_body: Dict[str, Any]) -> Dict[str, Any
if definition_body.get("swagger") is not None:
return definition_body

if self.feature_toggle and self.feature_toggle.is_enabled("normalized_open_api_version"):
if self.feature_toggle and self.feature_toggle.is_enabled(FEATURE_FLAG_NORMALIZED_OPENAPI_VERSION):
normalized_open_api_version = definition_body.get("openapi", self.open_api_version)
elif definition_body.get("openapi") is not None and self.open_api_version is None:
normalized_open_api_version = definition_body.get("openapi")
Expand Down

0 comments on commit 7e891c2

Please sign in to comment.