forked from goadesign/goa-cellar
/
user_types.go
47 lines (45 loc) · 1012 Bytes
/
user_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package design
import (
. "github.com/goadesign/goa/design"
. "github.com/goadesign/goa/design/apidsl"
)
// BottlePayload defines the data structure used in the create bottle request body.
// It is also the base type for the bottle media type used to render bottles.
var BottlePayload = Type("BottlePayload", func() {
Attribute("name", func() {
MinLength(2)
Example("Number 8")
})
Attribute("vineyard", func() {
MinLength(2)
Example("Asti")
})
Attribute("varietal", func() {
MinLength(4)
Example("Merlot")
})
Attribute("vintage", Integer, func() {
Minimum(1900)
Maximum(2020)
Example(2012)
})
Attribute("color", func() {
Enum("red", "white", "rose", "yellow", "sparkling")
})
Attribute("sweetness", Integer, func() {
Minimum(1)
Maximum(5)
})
Attribute("country", func() {
MinLength(2)
Example("USA")
})
Attribute("region", func() {
Example("Napa Valley")
})
Attribute("review", func() {
MinLength(3)
MaxLength(300)
Example("Great and inexpensive")
})
})