Skip to content

Commit ec0c3cb

Browse files
APM-5171 allow numbers in api name and env suffix when validating Apigee namespace
1 parent bf072df commit ec0c3cb

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

ansible/collections/ansible_collections/nhsd/apigee/plugins/module_utils/models/ansible/validate_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def correct_namespace(name, api_name, env_name) -> bool:
2525
:param api_name: The meta.api.name item from your manifest
2626
:param env_name: The environment name (e.g. 'internal-dev', 'int', or 'prod')
2727
"""
28-
regex = f"^{api_name}(-[a-z]+)*-{env_name}(-[a-z]+)*$"
28+
regex = f"^{api_name}(-[a-z0-9]+)*-{env_name}(-[a-z0-9]+)*$"
2929
return bool(re.match(regex, name))
3030

3131

ansible/collections/ansible_collections/nhsd/apigee/tests/unit/plugins/module_utils/models/ansible/test_correct_namespace.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def test_correct_namespace_with_both_types_of_suffix():
2727
assert correct_namespace("canary-api-suffix-internal-dev-application-restricted", API_NAME, ENV_NAME) is True
2828

2929

30+
def test_correct_namespace_with_number_in_suffix():
31+
assert correct_namespace("canary-api-suffix1-internal-dev-suffix2", API_NAME, ENV_NAME) is True
32+
33+
3034
def test_correct_namespace_missing_hyphen_1():
3135
assert correct_namespace("canary-apisuffix-internal-dev-application-restricted", API_NAME, ENV_NAME) is False
3236

0 commit comments

Comments
 (0)