-
Notifications
You must be signed in to change notification settings - Fork 6
/
inputs.go
156 lines (145 loc) · 4.35 KB
/
inputs.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package models
import (
"encoding/json"
"strconv"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
)
// These imports may not be used depending on the input parameters
var _ = json.Marshal
var _ = strconv.FormatInt
var _ = validate.Maximum
var _ = strfmt.NewFormats
// GetBooksInput holds the input parameters for a getBooks operation.
type GetBooksInput struct {
Authors []string
Available *bool
State *string
Published *strfmt.Date
SnakeCase *string
Completed *strfmt.DateTime
MaxPages *float64
MinPages *int32
PagesToTime *float32
}
// Validate returns an error if any of the GetBooksInput parameters don't satisfy the
// requirements from the swagger yml file.
func (i GetBooksInput) Validate() error {
if i.Authors != nil {
if err := validate.MaxItems("authors", "query", int64(len(i.Authors)), 2); err != nil {
return err
}
}
if i.Authors != nil {
if err := validate.MinItems("authors", "query", int64(len(i.Authors)), 1); err != nil {
return err
}
}
if i.Authors != nil {
if err := validate.UniqueItems("authors", "query", i.Authors); err != nil {
return err
}
}
if i.State != nil {
if err := validate.Enum("state", "query", *i.State, []interface{}{"finished", "inprogress"}); err != nil {
return err
}
}
if i.Published != nil {
if err := validate.FormatOf("published", "query", "date", (*i.Published).String(), strfmt.Default); err != nil {
return err
}
}
if i.SnakeCase != nil {
if err := validate.MaxLength("snake_case", "query", string(*i.SnakeCase), 5); err != nil {
return err
}
}
if i.Completed != nil {
if err := validate.FormatOf("completed", "query", "date-time", (*i.Completed).String(), strfmt.Default); err != nil {
return err
}
}
if i.MaxPages != nil {
if err := validate.Maximum("maxPages", "query", float64(*i.MaxPages), 1000.000000, false); err != nil {
return err
}
}
if i.MaxPages != nil {
if err := validate.Minimum("maxPages", "query", float64(*i.MaxPages), -5.000000, false); err != nil {
return err
}
}
if i.MaxPages != nil {
if err := validate.MultipleOf("maxPages", "query", float64(*i.MaxPages), 0.500000); err != nil {
return err
}
}
return nil
}
// GetBookByIDInput holds the input parameters for a getBookByID operation.
type GetBookByIDInput struct {
BookID int64
AuthorID *string
Authorization *string
RandomBytes *strfmt.Base64
}
// Validate returns an error if any of the GetBookByIDInput parameters don't satisfy the
// requirements from the swagger yml file.
func (i GetBookByIDInput) Validate() error {
if err := validate.MaximumInt("book_id", "path", i.BookID, int64(10000000), false); err != nil {
return err
}
if err := validate.MinimumInt("book_id", "path", i.BookID, int64(2), false); err != nil {
return err
}
if err := validate.MultipleOf("book_id", "path", float64(i.BookID), 2.000000); err != nil {
return err
}
if i.AuthorID != nil {
if err := validate.FormatOf("authorID", "query", "mongo-id", *i.AuthorID, strfmt.Default); err != nil {
return err
}
}
if i.Authorization != nil {
if err := validate.MaxLength("authorization", "header", string(*i.Authorization), 24); err != nil {
return err
}
}
if i.Authorization != nil {
if err := validate.MinLength("authorization", "header", string(*i.Authorization), 24); err != nil {
return err
}
}
if i.Authorization != nil {
if err := validate.Pattern("authorization", "header", string(*i.Authorization), "[0-9a-f]+"); err != nil {
return err
}
}
if i.RandomBytes != nil {
if err := validate.FormatOf("randomBytes", "query", "byte", string(*i.RandomBytes), strfmt.Default); err != nil {
return err
}
}
return nil
}
// GetBookByID2Input holds the input parameters for a getBookByID2 operation.
type GetBookByID2Input struct {
ID string
}
// ValidateGetBookByID2Input returns an error if the input parameter doesn't
// satisfy the requirements in the swagger yml file.
func ValidateGetBookByID2Input(id string) error {
if err := validate.Pattern("id", "path", string(id), "^[0-9a-f]{24}$"); err != nil {
return err
}
return nil
}
// HealthCheckInput holds the input parameters for a healthCheck operation.
type HealthCheckInput struct {
}
// Validate returns an error if any of the HealthCheckInput parameters don't satisfy the
// requirements from the swagger yml file.
func (i HealthCheckInput) Validate() error {
return nil
}