From 0e58d3996bbcc2cd9743303d40e3ead425a6d266 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Sat, 1 Apr 2023 23:37:57 +0100 Subject: [PATCH] APIGateway: Allow semicolon in path (#6159) --- moto/apigateway/models.py | 2 +- tests/test_apigateway/test_apigateway.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/moto/apigateway/models.py b/moto/apigateway/models.py index eb7935f33..bccbbdd7d 100644 --- a/moto/apigateway/models.py +++ b/moto/apigateway/models.py @@ -1734,7 +1734,7 @@ class APIGatewayBackend(BaseBackend): if not path_part: # We're attempting to create the default resource, which already exists. return api.default - if not re.match("^\\{?[a-zA-Z0-9._-]+\\+?\\}?$", path_part): + if not re.match("^\\{?[a-zA-Z0-9._\\-\\:]+\\+?\\}?$", path_part): raise InvalidResourcePathException() return api.add_child(path=path_part, parent_id=parent_resource_id) diff --git a/tests/test_apigateway/test_apigateway.py b/tests/test_apigateway/test_apigateway.py index 911850a90..85129f7b9 100644 --- a/tests/test_apigateway/test_apigateway.py +++ b/tests/test_apigateway/test_apigateway.py @@ -272,7 +272,7 @@ def test_create_resource__validate_name(): ]["id"] invalid_names = ["/users", "users/", "users/{user_id}", "us{er", "us+er"] - valid_names = ["users", "{user_id}", "{proxy+}", "user_09", "good-dog"] + valid_names = ["users", "{user_id}", "{proxy+}", "{pro:xy+}", "us:er_0-9"] # All invalid names should throw an exception for name in invalid_names: with pytest.raises(ClientError) as ex: