Automatically generate V2 API specification
This changeset provides data structures and definitions describing the routes available in the V2 registry API. These route descriptors are structured to provide automated registration, for creating routers, in addition to complete documentation duty. It's also a possibility that this could be used to enumerate test coverage for server implementation. Using this functionality, we've also developed a template to automatically generate and API specification for submission into docker core.
This commit is contained in:
parent
3a46ac26d8
commit
06ebc514a7
8 changed files with 1717 additions and 141 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"hash"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker-registry/common"
|
||||
|
@ -36,6 +37,9 @@ func NewDigest(alg string, h hash.Hash) Digest {
|
|||
return Digest(fmt.Sprintf("%s:%x", alg, h.Sum(nil)))
|
||||
}
|
||||
|
||||
// DigestRegexp matches valid digest types.
|
||||
var DigestRegexp = regexp.MustCompile(`[a-zA-Z0-9-_+.]+:[a-zA-Z0-9-_+.=]+`)
|
||||
|
||||
var (
|
||||
// ErrDigestInvalidFormat returned when digest format invalid.
|
||||
ErrDigestInvalidFormat = fmt.Errorf("invalid checksum digest format")
|
||||
|
@ -125,6 +129,8 @@ func (d Digest) Validate() error {
|
|||
return ErrDigestUnsupported
|
||||
}
|
||||
|
||||
// TODO(stevvooe): Use DigestRegexp to validate digest here.
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue