Advertisement
Guest User

Untitled

a guest
Nov 10th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. swagger: "2.0"
  2. info:
  3. description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
  4. version: "1.0.0"
  5. title: "Automated Library Management System"
  6.  
  7. host: "library.api"
  8. basePath: "/v1"
  9. tags:
  10. - name: "books"
  11. description: "books related operations"
  12. schemes:
  13. - "http"
  14.  
  15. paths:
  16. /login:
  17. post:
  18. summary: Logs in and returns the authentication cookie
  19. requestBody:
  20. required: true
  21. description: A JSON object containing the login and password.
  22. content:
  23. application/json:
  24. schema:
  25. $ref: '#/definitions/LoginRequest'
  26. responses:
  27. 200:
  28. description: >
  29. Successfully authenticated.
  30. The session ID is returned in a cookie named `JSESSIONID`. You need to include this cookie in subsequent requests.
  31. headers:
  32. Set-Cookie:
  33. schema:
  34. type: string
  35. example: JSESSIONID=abcde12345; Path=/; HttpOnly
  36.  
  37.  
  38. /books/{bookId}:
  39. get:
  40. tags:
  41. - "books"
  42. summary: Lookup book by id
  43. description: Returns a book dataset.
  44. security:
  45. - cookieAuth: []
  46. parameters:
  47. - name: "bookId"
  48. in: "path"
  49. description: "The book details that needs to be fetched."
  50. required: true
  51. type: "string"
  52. responses:
  53. 200:
  54. description: returns a book dataset
  55. schema:
  56. $ref: "#/definitions/Book"
  57. 400:
  58. description: "Invalid bookdId supplied"
  59. 404:
  60. description: "Book not found"
  61. /books:
  62. get:
  63. tags:
  64. - "books"
  65. summary: Lookup book by bookTitle
  66. description: Returns the matching book array
  67. parameters:
  68. - name: "bookTitle"
  69. in: "query"
  70. description: "The name that needs to be fetched. Use user1 for testing. "
  71. required: true
  72. type: "string"
  73. responses:
  74. 200:
  75. description: returns a book array
  76. schema:
  77. type: array
  78. items:
  79. required:
  80. - id
  81. properties:
  82. bookTitle:
  83. type: string
  84. ISBN:
  85. type: string
  86. author:
  87. type: string
  88.  
  89. /books/{bookId}/checkout:
  90. post:
  91. tags:
  92. - "books"
  93. summary: "checkouts a book for the user"
  94. description: ""
  95. consumes:
  96. - "application/json"
  97. produces:
  98. - "application/json"
  99. parameters:
  100. - in: "path"
  101. name: "bookId"
  102. type: string
  103. description: "Pet object that needs to be added to the store"
  104. required: true
  105. responses:
  106. 405:
  107. description: "Invalid input"
  108. /books/checkout:
  109. post:
  110. tags:
  111. - "books"
  112. summary: "bulk checkout books for the user"
  113. description: ""
  114. consumes:
  115. - "application/json"
  116. produces:
  117. - "application/json"
  118. parameters:
  119. - in: "body"
  120. name: "body"
  121. description: "Books object"
  122. required: true
  123. schema:
  124. $ref: "#/definitions/Book"
  125. responses:
  126. 405:
  127. description: "Invalid input"
  128.  
  129. /books/{bookId}/checkin:
  130. post:
  131. tags:
  132. - "books"
  133. summary: "checkouts a book for the user"
  134. description: ""
  135. consumes:
  136. - "application/json"
  137. produces:
  138. - "application/json"
  139. parameters:
  140. - in: "path"
  141. name: "bookId"
  142. type: string
  143. description: "Pet object that needs to be added to the store"
  144. required: true
  145. responses:
  146. 405:
  147. description: "Invalid input"
  148. /books/checkin:
  149. post:
  150. tags:
  151. - "books"
  152. summary: "bulk checkout books for the user"
  153. description: ""
  154. consumes:
  155. - "application/json"
  156. produces:
  157. - "application/json"
  158. parameters:
  159. - in: "body"
  160. name: "body"
  161. description: "Books object"
  162. required: true
  163. schema:
  164. $ref: "#/definitions/Book"
  165. responses:
  166. 405:
  167. description: "Invalid input"
  168.  
  169.  
  170. definitions:
  171. Book:
  172. type: "object"
  173. properties:
  174. id:
  175. type: "string"
  176. ISBN:
  177. type: "string"
  178. total_copies:
  179. type: "integer"
  180. available_copies:
  181. type: "integer"
  182. image_url:
  183. type: "string"
  184. author:
  185. type: "string"
  186. publisher:
  187. type: "string"
  188. category:
  189. type: "string"
  190. # A simple username/password combo for logging in
  191. LoginRequest:
  192. required: [username, password]
  193. properties:
  194. username:
  195. type: string
  196. minLength: 1
  197. password:
  198. type: string
  199. minLength: 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement