diff --git a/packages/amplify-category-api/src/__tests__/provider-utils/awscloudformation/utils/rest-api-path-utils.test.ts b/packages/amplify-category-api/src/__tests__/provider-utils/awscloudformation/utils/rest-api-path-utils.test.ts index 6facce6d56..b7a1ae6893 100644 --- a/packages/amplify-category-api/src/__tests__/provider-utils/awscloudformation/utils/rest-api-path-utils.test.ts +++ b/packages/amplify-category-api/src/__tests__/provider-utils/awscloudformation/utils/rest-api-path-utils.test.ts @@ -27,7 +27,7 @@ test('validatePathName_hasTrailingSlash', () => { test('validatePathName_invalidCharacters', () => { // setup const errorMessage = - 'Each path part must use characters a-z A-Z 0-9 - and must not be empty.\nOptionally, a path part can be surrounded by { } to denote a path parameter.'; + 'Each path part must use characters a-z A-Z 0-9 - _ : , . and must not be empty.\nOptionally, a path part with characters a-z A-Z 0-9 - _ can be surrounded by { } to denote a path parameter.'; // test expect(validatePathName('/invalid+/{char}')).toStrictEqual(errorMessage); diff --git a/packages/amplify-category-api/src/provider-utils/awscloudformation/utils/rest-api-path-utils.ts b/packages/amplify-category-api/src/provider-utils/awscloudformation/utils/rest-api-path-utils.ts index b0ef42fde3..74ffe6aed7 100644 --- a/packages/amplify-category-api/src/provider-utils/awscloudformation/utils/rest-api-path-utils.ts +++ b/packages/amplify-category-api/src/provider-utils/awscloudformation/utils/rest-api-path-utils.ts @@ -20,8 +20,8 @@ export const validatePathName = (name: string) => { // Matches parameterized paths such as /book/{isbn}/page/{pageNum} // This regex also catches the above conditions, but those are left in to provide clearer error messages. - if (!/^(?:\/(?:[a-zA-Z0-9\-]+|{[a-zA-Z0-9\-]+}))+$/.test(name)) { - return 'Each path part must use characters a-z A-Z 0-9 - and must not be empty.\nOptionally, a path part can be surrounded by { } to denote a path parameter.'; + if (!/^(?:\/(?:[a-zA-Z0-9\-_:,.]+|{[a-zA-Z0-9\-_]+}))+$/.test(name)) { + return 'Each path part must use characters a-z A-Z 0-9 - _ : , . and must not be empty.\nOptionally, a path part with characters a-z A-Z 0-9 - _ can be surrounded by { } to denote a path parameter.'; } return true;