Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion samtranslator/model/apigateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class ApiGatewayAccount(Resource):


class ApiGatewayDeployment(Resource):
_X_HASH_DELIMITER = '||'

resource_type = 'AWS::ApiGateway::Deployment'
property_types = {
'Description': PropertyType(False, is_str()),
Expand Down Expand Up @@ -90,9 +92,10 @@ def make_auto_deployable(self, stage, openapi_version=None, swagger=None):
# to prevent redeployment when API has not changed

# NOTE: `str(swagger)` is for backwards compatibility. Changing it to a JSON or something will break compat
# NOTE: If extending the hash data, make sure to add delimiter between the previous data and the new data.
hash_input = str(swagger)
if openapi_version:
hash_input = hash_input + str(openapi_version)
hash_input = hash_input + self._X_HASH_DELIMITER + str(openapi_version)
generator = logical_id_generator.LogicalIdGenerator(self.logical_id, hash_input)
self.logical_id = generator.gen()
hash = generator.get_hash(length=40) # Get the full hash
Expand Down