github.com/youyuanwu/go-swagger@v0.19.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 // A ComplexerOneParams is composed of a SimpleOne and some extra fields 91 // swagger:parameters yetAnotherOperation 92 type ComplexerOneParams struct { 93 SimpleOne 94 mods.NotSelected 95 mods.Notable 96 CreatedAt strfmt.DateTime `json:"createdAt"` 97 Secret string `json:"-"` 98 99 // in: formData 100 Informity string `json:"informity"` 101 102 NoTagName string `json:",omitempty"` 103 } 104 105 // NoParams is a struct that exists in a package 106 // but is not annotated with the swagger params annotations 107 // so it should now show up in a test 108 // 109 // swagger:parameters someOperation 110 // swagger:parameters anotherOperation 111 type NoParams struct { 112 // ID of this no model instance. 113 // ids in this application start at 11 and are smaller than 1000 114 // 115 // required: true 116 // minimum: > 10 117 // maximum: < 1000 118 // in: path 119 // default: 1 120 ID int64 `json:"id"` 121 122 // The Score of this model 123 // 124 // required: true 125 // minimum: 3 126 // maximum: 45 127 // multiple of: 3 128 // in: query 129 // default: 2 130 // example: 27 131 Score int32 `json:"score"` 132 133 // Name of this no model instance 134 // 135 // min length: 4 136 // max length: 50 137 // pattern: [A-Za-z0-9-.]* 138 // required: true 139 // in: header 140 Name string `json:"x-hdr-name"` 141 142 // Created holds the time when this entry was created 143 // 144 // required: false 145 // in: query 146 Created strfmt.DateTime `json:"created"` 147 148 // The Category of this model 149 // 150 // required: true 151 // enum: foo,bar,none 152 // default: bar 153 // in: query 154 Category string `json:"category"` 155 156 // a FooSlice has foos which are strings 157 // 158 // min items: 3 159 // max items: 10 160 // unique: true 161 // items.minLength: 3 162 // items.maxLength: 10 163 // items.pattern: \w+ 164 // collection format: pipe 165 // items.default: bar 166 // in: query 167 FooSlice []string `json:"foo_slice"` 168 169 // a BarSlice has bars which are strings 170 // 171 // min items: 3 172 // max items: 10 173 // unique: true 174 // items.minItems: 4 175 // items.maxItems: 9 176 // items.enum: bar1,bar2,bar3 177 // items.default: bar2 178 // items.items.minItems: 5 179 // items.items.maxItems: 8 180 // items.items.items.minLength: 3 181 // items.items.items.maxLength: 10 182 // items.items.items.pattern: \w+ 183 // collection format: pipe 184 // in: query 185 BarSlice [][][]string `json:"bar_slice"` 186 187 // the items for this order 188 // 189 // in: body 190 Items []struct { 191 // ID of this no model instance. 192 // ids in this application start at 11 and are smaller than 1000 193 // 194 // required: true 195 // minimum: > 10 196 // maximum: < 1000 197 // default: 3 198 ID int32 `json:"id"` 199 200 // The Pet to add to this NoModel items bucket. 201 // Pets can appear more than once in the bucket 202 // 203 // required: true 204 Pet *mods.Pet `json:"pet"` 205 206 // The amount of pets to add to this bucket. 207 // 208 // required: true 209 // minimum: 1 210 // maximum: 10 211 Quantity int16 `json:"quantity"` 212 213 // Notes to add to this item. 214 // This can be used to add special instructions. 215 // 216 // 217 // required: false 218 Notes string `json:"notes"` 219 } `json:"items"` 220 } 221 222 // NoParamsAlias is a struct that exists in a package 223 // but is not annotated with the swagger params annotations 224 // so it should now show up in a test 225 // 226 // swagger:parameters someAliasOperation 227 type NoParamsAlias struct { 228 // default "in" is "query" => this params should be aliased 229 // required: true 230 // minimum: 1 231 // maximum: 10 232 IntAlias SomeIntType `json:"intAlias"` 233 StringAlias SomeStringType `json:"stringAlias"` 234 // in: path 235 IntAliasPath SomeIntType `json:"intAliasPath"` 236 // in: formData 237 IntAliasForm SomeIntType `json:"intAliasForm"` 238 } 239 240 // SomeStringType is a type that refines string 241 type SomeStringType string 242 243 // SomeIntType is a type that refines int64 244 type SomeIntType int64