github.com/go-swagger/go-swagger@v0.31.0/fixtures/goparsing/classification/operations/noparams.go (about) 1 // Copyright 2015 go-swagger maintainers 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package operations 16 17 import ( 18 "bytes" 19 20 "github.com/go-openapi/strfmt" 21 "github.com/go-swagger/go-swagger/fixtures/goparsing/classification/models" 22 "github.com/go-swagger/go-swagger/fixtures/goparsing/classification/transitive/mods" 23 ) 24 25 // MyFileParams contains the uploaded file data 26 // swagger:parameters myOperation 27 type MyFileParams struct { 28 // MyFormFile desc. 29 // 30 // in: formData 31 // 32 // swagger:file 33 MyFormFile *bytes.Buffer `json:"myFormFile"` 34 } 35 36 // MyFunc contains a struct with parameters. 37 func MyFunc() { 38 // MyFuncFileParams contains the uploaded file data in a function. 39 // swagger:parameters myFuncOperation 40 type MyFuncFileParams struct { 41 // MyFormFile desc. 42 // 43 // in: formData 44 // 45 // swagger:file 46 MyFormFile *bytes.Buffer `json:"myFormFile"` 47 } 48 } 49 50 // EmbeddedFileParams embeds a *MyFileParams 51 // swagger:parameters myOtherOperation 52 type EmbeddedFileParams struct { 53 *MyFileParams 54 55 // ExtraParam desc. 56 // in: formData 57 // required: true 58 ExtraParam int `json:"extraParam"` 59 } 60 61 // An OrderBodyParams model. 62 // 63 // This is used for operations that want an Order as body of the request 64 // swagger:parameters updateOrder 65 // swagger:parameters createOrder 66 type OrderBodyParams struct { 67 // The order to submit. 68 // 69 // in: body 70 // required: true 71 Order *models.StoreOrder `json:"order"` 72 } 73 74 // An MultipleOrderParams model. 75 // 76 // This is used for operations that want multiple orders as the body 77 // swagger:parameters getOrders 78 type MultipleOrderParams struct { 79 // The orders 80 // required: true 81 Orders []*OrderBodyParams `json:"orders"` 82 83 // And another thing 84 // in: body 85 Another []struct { 86 That string `json:"that"` 87 } `json:"another"` 88 } 89 90 // Success 91 // swagger:parameters getConfiguration 92 type SetConfiguration struct { 93 // in:body 94 Value map[string]string 95 } 96 97 // swagger:parameters putNumPlate 98 type NumPlates struct { 99 // in: body 100 NumPlates interface{} `json:"num_plates"` 101 } 102 103 // A ComplexerOneParams is composed of a SimpleOne and some extra fields 104 // swagger:parameters yetAnotherOperation 105 type ComplexerOneParams struct { 106 SimpleOne 107 mods.NotSelected 108 mods.Notable 109 CreatedAt strfmt.DateTime `json:"createdAt"` 110 Secret string `json:"-"` 111 112 // in: formData 113 Informity string `json:"informity"` 114 115 NoTagName string `json:",omitempty"` 116 } 117 118 // NoParams is a struct that exists in a package 119 // but is not annotated with the swagger params annotations 120 // so it should now show up in a test 121 // 122 // swagger:parameters someOperation 123 // swagger:parameters anotherOperation 124 type NoParams struct { 125 // ID of this no model instance. 126 // ids in this application start at 11 and are smaller than 1000 127 // 128 // required: true 129 // minimum: > 10 130 // maximum: < 1000 131 // in: path 132 // default: 1 133 ID int64 `json:"id"` 134 135 // The Score of this model 136 // 137 // required: true 138 // minimum: 3 139 // maximum: 45 140 // multiple of: 3 141 // in: query 142 // default: 2 143 // example: 27 144 Score int32 `json:"score"` 145 146 // Name of this no model instance 147 // 148 // min length: 4 149 // max length: 50 150 // pattern: [A-Za-z0-9-.]* 151 // required: true 152 // in: header 153 Name string `json:"x-hdr-name"` 154 155 // Created holds the time when this entry was created 156 // 157 // required: false 158 // in: query 159 Created strfmt.DateTime `json:"created"` 160 161 // The Category of this model (old enum format) 162 // 163 // required: true 164 // enum: foo,bar,none 165 // default: bar 166 // in: query 167 CategoryOld string `json:"category_old"` 168 169 // The Category of this model 170 // 171 // required: true 172 // enum: ["foo","bar","none"] 173 // default: bar 174 // in: query 175 Category string `json:"category"` 176 177 // Type of this model (old enum format) 178 // 179 // enum: 1,3,5 180 // default: 1 181 // in: query 182 TypeOld int `json:"type_old"` 183 184 // Type of this model 185 // 186 // enum: [1,3,5] 187 // default: 1 188 // in: query 189 Type int `json:"type"` 190 191 // This is mix in enum. And actually on output should be valid form where int will be int and 192 // string will also be presented. 193 // 194 // enum: [1,"rsq","qaz"] 195 // in: query 196 BadEnum int `json:"bad_enum"` 197 198 // a FooSlice has foos which are strings 199 // 200 // min items: 3 201 // max items: 10 202 // unique: true 203 // items.minLength: 3 204 // items.maxLength: 10 205 // items.pattern: \w+ 206 // collection format: pipe 207 // items.default: bar 208 // in: query 209 FooSlice []string `json:"foo_slice"` 210 211 // a BarSlice has bars which are strings 212 // 213 // min items: 3 214 // max items: 10 215 // unique: true 216 // items.minItems: 4 217 // items.maxItems: 9 218 // items.enum: ["bar1","bar2","bar3"] 219 // items.default: bar2 220 // items.items.minItems: 5 221 // items.items.maxItems: 8 222 // items.items.items.minLength: 3 223 // items.items.items.maxLength: 10 224 // items.items.items.pattern: \w+ 225 // collection format: pipe 226 // in: query 227 BarSlice [][][]string `json:"bar_slice"` 228 229 // the items for this order 230 // 231 // in: body 232 Items []struct { 233 // ID of this no model instance. 234 // ids in this application start at 11 and are smaller than 1000 235 // 236 // required: true 237 // minimum: > 10 238 // maximum: < 1000 239 // default: 3 240 ID int32 `json:"id"` 241 242 // The Pet to add to this NoModel items bucket. 243 // Pets can appear more than once in the bucket 244 // 245 // required: true 246 Pet *mods.Pet `json:"pet"` 247 248 // The amount of pets to add to this bucket. 249 // 250 // required: true 251 // minimum: 1 252 // maximum: 10 253 Quantity int16 `json:"quantity"` 254 255 // Notes to add to this item. 256 // This can be used to add special instructions. 257 // 258 // 259 // required: false 260 Notes string `json:"notes"` 261 } `json:"items"` 262 } 263 264 // NoParamsAlias is a struct that exists in a package 265 // but is not annotated with the swagger params annotations 266 // so it should now show up in a test 267 // 268 // swagger:parameters someAliasOperation 269 type NoParamsAlias struct { 270 // default "in" is "query" => this params should be aliased 271 // required: true 272 // minimum: 1 273 // maximum: 10 274 IntAlias SomeIntType `json:"intAlias"` 275 StringAlias SomeStringType `json:"stringAlias"` 276 // in: path 277 IntAliasPath SomeIntType `json:"intAliasPath"` 278 // in: formData 279 IntAliasForm SomeIntType `json:"intAliasForm"` 280 } 281 282 // SomeStringType is a type that refines string 283 type SomeStringType string 284 285 // SomeIntType is a type that refines int64 286 type SomeIntType int64