github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/goparsing/classification/operations_body/todo_operation_body.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 // ListPetParams the params for the list pets query 18 type ListPetParams struct { 19 // OutOfStock when set to true only the pets that are out of stock will be returned 20 OutOfStock bool 21 } 22 23 // ServeAPI serves the API for this record store 24 func ServeAPI(host, basePath string, schemes []string) error { 25 26 // swagger:route GET /pets pets users listPets 27 // 28 // Lists pets filtered by some parameters. 29 // 30 // This will show all available pets by default. 31 // You can get the pets that are out of stock 32 // 33 // Consumes: 34 // application/json 35 // application/x-protobuf 36 // 37 // Produces: 38 // application/json 39 // application/x-protobuf 40 // 41 // Schemes: http, https, ws, wss 42 // 43 // Security: 44 // api_key: 45 // oauth: read, write 46 // 47 // Responses: 48 // default: body:genericError 49 // 200: body:someResponse 50 // 422: body:validationError 51 // 52 // Extensions: 53 // x-some-flag: true 54 mountItem("GET", basePath+"/pets", nil) 55 56 /* swagger:route POST /pets pets users createPet 57 58 Create a pet based on the parameters. 59 60 Consumes: 61 - application/json 62 - application/x-protobuf 63 64 Produces: 65 - application/json 66 - application/x-protobuf 67 68 Schemes: http, https, ws, wss 69 70 Parameters: 71 + name: request 72 description: The request model. 73 in: body 74 type: petModel 75 unknown: invalid key that will not get parsed. Added to increase coverage. 76 + name: id 77 description: The pet id 78 in: path 79 required: true 80 allowEmpty: false 81 82 Responses: 83 default: body:genericError 84 200: body:someResponse 85 422: body:validationError 86 87 Security: 88 api_key: 89 oauth: read, write */ 90 mountItem("POST", basePath+"/pets", nil) 91 92 // swagger:route GET /orders orders listOrders 93 // 94 // lists orders filtered by some parameters. 95 // 96 // Consumes: 97 // application/json 98 // application/x-protobuf 99 // 100 // Produces: 101 // application/json 102 // application/x-protobuf 103 // 104 // Schemes: http, https, ws, wss 105 // 106 // Security: 107 // api_key: 108 // oauth: orders:read, https://www.googleapis.com/auth/userinfo.email 109 // 110 // Parameters: 111 // 112 // Responses: 113 // default: body:genericError 114 // 200: body:someResponse 115 // 422: body:validationError 116 // 117 // Extensions: 118 // x-some-flag: false 119 // x-some-list: 120 // - item1 121 // - item2 122 // - item3 123 // x-some-object: 124 // key1: value1 125 // key2: value2 126 // subobject: 127 // subkey1: subvalue1 128 // subkey2: subvalue2 129 // key3: value3 130 mountItem("GET", basePath+"/orders", nil) 131 132 // swagger:route POST /orders orders createOrder 133 // 134 // create an order based on the parameters. 135 // 136 // Consumes: 137 // application/json 138 // application/x-protobuf 139 // 140 // Produces: 141 // application/json 142 // application/x-protobuf 143 // 144 // Schemes: http, https, ws, wss 145 // 146 // Security: 147 // api_key: 148 // oauth: read, write 149 // 150 // Parameters: 151 // + name: id 152 // description: The order id 153 // in: invalidIn 154 // required: false 155 // allowEmpty: true 156 // noValue (to increase coverage, line without colon, split result will be 1) 157 // + name: request 158 // description: The request model. 159 // in: body 160 // type: orderModel 161 // 162 // Responses: 163 // default: body:genericError 164 // 200: body:someResponse 165 // 422: body:validationError 166 mountItem("POST", basePath+"/orders", nil) 167 168 // swagger:route GET /orders/{id} orders orderDetails 169 // 170 // gets the details for an order. 171 // 172 // Consumes: 173 // application/json 174 // application/x-protobuf 175 // 176 // Produces: 177 // application/json 178 // application/x-protobuf 179 // 180 // Schemes: http, https, ws, wss 181 // 182 // Security: 183 // api_key: 184 // oauth: read, write 185 // 186 // Responses: 187 // default: body:genericError 188 // 200: body:someResponse 189 // 422: body:validationError 190 mountItem("GET", basePath+"/orders/:id", nil) 191 192 // swagger:route PUT /orders/{id} orders updateOrder 193 // 194 // Update the details for an order. 195 // 196 // When the order doesn't exist this will return an error. 197 // 198 // Consumes: 199 // application/json 200 // application/x-protobuf 201 // 202 // Produces: 203 // application/json 204 // application/x-protobuf 205 // 206 // Schemes: http, https, ws, wss 207 // 208 // Security: 209 // api_key: 210 // oauth: read, write 211 // 212 // Responses: 213 // default: body:genericError 214 // 200: body:someResponse 215 // 422: body:validationError 216 mountItem("PUT", basePath+"/orders/:id", nil) 217 218 // swagger:route DELETE /orders/{id} deleteOrder 219 // 220 // delete a particular order. 221 // 222 // Consumes: 223 // application/json 224 // application/x-protobuf 225 // 226 // Produces: 227 // application/json 228 // application/x-protobuf 229 // 230 // Schemes: http, https, ws, wss 231 // 232 // Security: 233 // api_key: 234 // oauth: read, write 235 // 236 // Responses: 237 // default: body:genericError 238 // 200: body:someResponse 239 // 422: body:validationError 240 mountItem("DELETE", basePath+"/orders/:id", nil) 241 242 // swagger:route POST /param-test params testParams 243 // 244 // Allow some params with constraints. 245 // 246 // Consumes: 247 // application/json 248 // application/x-protobuf 249 // 250 // Produces: 251 // application/json 252 // application/x-protobuf 253 // 254 // Schemes: http, https, ws, wss 255 // 256 // Security: 257 // api_key: 258 // oauth: read, write 259 // 260 // Parameters: 261 // + name: someNumber 262 // description: some number 263 // in: path 264 // required: true 265 // allowEmpty: true 266 // type: number 267 // max: 20 268 // min: 10 269 // default: 15 270 // + name: someQuery 271 // description: some query values 272 // in: query 273 // type: array 274 // minLength: 5 275 // maxLength: 20 276 // + name: someBoolean 277 // in: path 278 // description: some boolean 279 // type: boolean 280 // default: true 281 // + name: constraintsOnInvalidType 282 // description: test constraints on invalid types 283 // in: query 284 // type: bool 285 // min: 1 286 // max: 10 287 // minLength: 1 288 // maxLength: 10 289 // format: abcde 290 // default: false 291 // + name: noType 292 // description: test no type 293 // min: 1 294 // max: 10 295 // minLength: 1 296 // maxLength: 10 297 // default: something 298 // + name: request 299 // description: The request model. 300 // in: body 301 // type: string 302 // enum: apple, orange, pineapple, peach, plum 303 // default: orange 304 // 305 // Responses: 306 // default: body:genericError 307 // 200: body:someResponse 308 // 422: body:validationError 309 mountItem("POST", basePath+"/param-test", nil) 310 311 return nil 312 } 313 314 // not really used but I need a method to decorate the calls to 315 func mountItem(method, path string, handler interface{}) {}