You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ecr): make validateRepositoryName errors human readable (#27186)
When a user specifies an invalid repository name, the error message will now describe why the name is invalid instead of providing the regex used to validate the name. The message comes from the console when defining a new repository. The docstring of `repositoryName` now reflects this and mirrors the docstring of the underlying CFN resource.
Closes#26715.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
* The repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, and forward slashes.
499
+
*
500
+
* > If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
497
501
*
498
502
* @default Automatically generated name.
499
503
*/
@@ -672,7 +676,7 @@ export class Repository extends RepositoryBase {
errors.push('Repository name must follow the specified pattern: (?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*');
679
+
errors.push('Repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, periods and forward slashes');
})).toThrow('Repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, periods and forward slashes');
927
927
928
928
expect(()=>newecr.Repository(stack,'Repo2',{
929
929
repositoryName: 'a--a',
930
-
})).toThrow(/mustfollowthespecifiedpattern/);
930
+
})).toThrow('Repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, periods and forward slashes');
931
931
932
932
expect(()=>newecr.Repository(stack,'Repo3',{
933
933
repositoryName: 'a./a-a',
934
-
})).toThrow(/mustfollowthespecifiedpattern/);
934
+
})).toThrow('Repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, periods and forward slashes');
935
935
936
936
expect(()=>newecr.Repository(stack,'Repo4',{
937
937
repositoryName: 'a//a-a',
938
-
})).toThrow(/mustfollowthespecifiedpattern/);
938
+
})).toThrow('Repository name must start with a letter and can only contain lowercase letters, numbers, hyphens, underscores, periods and forward slashes');
0 commit comments