Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions api/v1/design/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import (
g "goa.design/goa/v3/dsl"
)

// Allows IDs that are:
// - 1-63 characters
// - Contain only lower-cased letters and hyphens
// - Starts with a letter or number
// - Ends with a letter or number
// The handlers must also validate that there are no consecutive hyphens.
const idPattern = `^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$`

var Identifier = g.Type("Identifier", g.String, func() {
g.Description("A user-specified identifier. Must be 1-63 characters, contain only lower-cased letters and hyphens, start and end with a letter or number, and not contain consecutive hyphens.")
g.Pattern(idPattern)
// Intentionally not using a pattern here for two reasons:
// - Go regex doesn't support lookahead, so we can't express the consecutive
// hyphen rule.
// - The pattern is somewhat complex, so the error message is hard to
// interpret when the value doesn't match.
g.MinLength(1)
g.MaxLength(63)
g.Example("production")
g.Example("my-app")
g.Example("76f9b8c0-4958-11f0-a489-3bb29577c696")
Expand Down
1 change: 0 additions & 1 deletion api/v1/design/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var HostIDs = g.ArrayOf(Identifier, func() {
})

var DatabaseNodeSpec = g.Type("DatabaseNodeSpec", func() {
// TODO: Validation to enforce that node names are unique within a database.
g.Attribute("name", g.String, func() {
g.Description("The name of the database node.")
g.Pattern(nodeNamePattern)
Expand Down
77 changes: 68 additions & 9 deletions api/v1/gen/control_plane/views/view.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 90 additions & 14 deletions api/v1/gen/http/control_plane/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading