/fixtures/goparsing/classification/operations_body/todo_operation_body.go

https://github.com/go-swagger/go-swagger · Go · 298 lines · 16 code · 13 blank · 269 comment · 0 complexity · 1b686e1a1ae5bd3ee3389d6028e3af34 MD5 · raw file

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