This repository has been archived by the owner on May 24, 2023. It is now read-only.
forked from go-swagger/go-swagger
/
noparams.go
244 lines (217 loc) · 5.74 KB
/
noparams.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
// Copyright 2015 go-swagger maintainers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package operations
import (
"bytes"
"github.com/go-openapi/strfmt"
"github.com/go-swagger/go-swagger/fixtures/goparsing/classification/models"
"github.com/go-swagger/go-swagger/fixtures/goparsing/classification/transitive/mods"
)
// MyFileParams contains the uploaded file data
// swagger:parameters myOperation
type MyFileParams struct {
// MyFormFile desc.
//
// in: formData
//
// swagger:file
MyFormFile *bytes.Buffer `json:"myFormFile"`
}
// MyFunc contains a struct with parameters.
func MyFunc() {
// MyFuncFileParams contains the uploaded file data in a function.
// swagger:parameters myFuncOperation
type MyFuncFileParams struct {
// MyFormFile desc.
//
// in: formData
//
// swagger:file
MyFormFile *bytes.Buffer `json:"myFormFile"`
}
}
// EmbeddedFileParams embeds a *MyFileParams
// swagger:parameters myOtherOperation
type EmbeddedFileParams struct {
*MyFileParams
// ExtraParam desc.
// in: formData
// required: true
ExtraParam int `json:"extraParam"`
}
// An OrderBodyParams model.
//
// This is used for operations that want an Order as body of the request
// swagger:parameters updateOrder
// swagger:parameters createOrder
type OrderBodyParams struct {
// The order to submit.
//
// in: body
// required: true
Order *models.StoreOrder `json:"order"`
}
// An MultipleOrderParams model.
//
// This is used for operations that want multiple orders as the body
// swagger:parameters getOrders
type MultipleOrderParams struct {
// The orders
// required: true
Orders []*OrderBodyParams `json:"orders"`
// And another thing
// in: body
Another []struct {
That string `json:"that"`
} `json:"another"`
}
// A ComplexerOneParams is composed of a SimpleOne and some extra fields
// swagger:parameters yetAnotherOperation
type ComplexerOneParams struct {
SimpleOne
mods.NotSelected
mods.Notable
CreatedAt strfmt.DateTime `json:"createdAt"`
Secret string `json:"-"`
// in: formData
Informity string `json:"informity"`
NoTagName string `json:",omitempty"`
}
// NoParams is a struct that exists in a package
// but is not annotated with the swagger params annotations
// so it should now show up in a test
//
// swagger:parameters someOperation
// swagger:parameters anotherOperation
type NoParams struct {
// ID of this no model instance.
// ids in this application start at 11 and are smaller than 1000
//
// required: true
// minimum: > 10
// maximum: < 1000
// in: path
// default: 1
ID int64 `json:"id"`
// The Score of this model
//
// required: true
// minimum: 3
// maximum: 45
// multiple of: 3
// in: query
// default: 2
// example: 27
Score int32 `json:"score"`
// Name of this no model instance
//
// min length: 4
// max length: 50
// pattern: [A-Za-z0-9-.]*
// required: true
// in: header
Name string `json:"x-hdr-name"`
// Created holds the time when this entry was created
//
// required: false
// in: query
Created strfmt.DateTime `json:"created"`
// The Category of this model
//
// required: true
// enum: foo,bar,none
// default: bar
// in: query
Category string `json:"category"`
// a FooSlice has foos which are strings
//
// min items: 3
// max items: 10
// unique: true
// items.minLength: 3
// items.maxLength: 10
// items.pattern: \w+
// collection format: pipe
// items.default: bar
// in: query
FooSlice []string `json:"foo_slice"`
// a BarSlice has bars which are strings
//
// min items: 3
// max items: 10
// unique: true
// items.minItems: 4
// items.maxItems: 9
// items.enum: bar1,bar2,bar3
// items.default: bar2
// items.items.minItems: 5
// items.items.maxItems: 8
// items.items.items.minLength: 3
// items.items.items.maxLength: 10
// items.items.items.pattern: \w+
// collection format: pipe
// in: query
BarSlice [][][]string `json:"bar_slice"`
// the items for this order
//
// in: body
Items []struct {
// ID of this no model instance.
// ids in this application start at 11 and are smaller than 1000
//
// required: true
// minimum: > 10
// maximum: < 1000
// default: 3
ID int32 `json:"id"`
// The Pet to add to this NoModel items bucket.
// Pets can appear more than once in the bucket
//
// required: true
Pet *mods.Pet `json:"pet"`
// The amount of pets to add to this bucket.
//
// required: true
// minimum: 1
// maximum: 10
Quantity int16 `json:"quantity"`
// Notes to add to this item.
// This can be used to add special instructions.
//
//
// required: false
Notes string `json:"notes"`
} `json:"items"`
}
// NoParamsAlias is a struct that exists in a package
// but is not annotated with the swagger params annotations
// so it should now show up in a test
//
// swagger:parameters someAliasOperation
type NoParamsAlias struct {
// default "in" is "query" => this params should be aliased
// required: true
// minimum: 1
// maximum: 10
IntAlias SomeIntType `json:"intAlias"`
StringAlias SomeStringType `json:"stringAlias"`
// in: path
IntAliasPath SomeIntType `json:"intAliasPath"`
// in: formData
IntAliasForm SomeIntType `json:"intAliasForm"`
}
// SomeStringType is a type that refines string
type SomeStringType string
// SomeIntType is a type that refines int64
type SomeIntType int64