From 6add5f30d2492c24dd142c59d175db800324ce1c Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Thu, 26 Feb 2015 16:06:36 -0800 Subject: [PATCH] documentation for name validation grammar Signed-off-by: Stephen J Day --- registry/api/v2/names.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/registry/api/v2/names.go b/registry/api/v2/names.go index ffac1858b..e889ffe04 100644 --- a/registry/api/v2/names.go +++ b/registry/api/v2/names.go @@ -82,6 +82,16 @@ var ( // registry. This function accepts a superset of what might be accepted by // docker core or docker hub. If the name does not pass validation, an error, // describing the conditions, is returned. +// +// Effectively, the name should comply with the following grammar: +// +// alpha-numeric := /[a-z0-9]+/ +// separator := /[._-]/ +// component := alpha-numeric [separator alpha-numeric]* +// namespace := component ['/' component]* +// +// The result of the production, known as the "namespace", should be limited +// to 255 characters. func ValidateRespositoryName(name string) error { if len(name) > RepositoryNameTotalLengthMax { return ErrRepositoryNameLong