Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. swagger: "2.0"
  2. info:
  3. version: "0.0.1"
  4. title: Hello World App
  5. # during dev, should point to your local machine
  6. host: localhost:10010
  7. # basePath prefixes all resource paths
  8. basePath: /
  9. #
  10. schemes:
  11. # tip: remove http to make production-grade
  12. - http
  13. - https
  14.  
  15. # format of bodies a client can send (Content-Type)
  16. consumes:
  17. - application/json
  18. - text/html
  19. - text/plain; charset=UTF-8
  20. # format of the responses to the client (Accepts)
  21. produces:
  22. - application/json
  23. - text/plain; charset=UTF-8
  24. - text/html
  25. paths:
  26. /movie:
  27. # our controller name
  28. x-swagger-router-controller: movie
  29. get:
  30. operationId: getAll
  31. description: get the movies list
  32. # define the type of response for Success "200" and Error
  33. responses:
  34. "200":
  35. description: Success
  36. schema:
  37. $ref: "#/definitions/GetMoviesListResponse"
  38. default:
  39. description: Error
  40. schema:
  41. $ref: "#/definitions/ErrorResponse"
  42. post:
  43. operationId: save
  44. description: add a new movie to the list
  45. # movie info to be stored
  46. parameters:
  47. - name: title
  48. description: Movie properties
  49. in: body
  50. required: true
  51. schema:
  52. $ref: "#/definitions/Movie"
  53. responses:
  54. "200":
  55. description: Success
  56. schema:
  57. $ref: "#/definitions/GeneralResponse"
  58. default:
  59. description: Error
  60. schema:
  61. $ref: "#/definitions/ErrorResponse"
  62. /movie/{id}:
  63. # our controller name
  64. x-swagger-router-controller: movie
  65. get:
  66. operationId: getOne
  67. description: get a movie
  68. # define the type of response for Success "200" and Error
  69. parameters:
  70. - name: id
  71. type: string
  72. in: path
  73. required: true
  74. responses:
  75. "200":
  76. description: Success
  77. schema:
  78. $ref: "#/definitions/GetMovieResponse"
  79. default:
  80. description: Error
  81. schema:
  82. $ref: "#/definitions/ErrorResponse"
  83. /swagger:
  84. x-swagger-pipe: swagger_raw
  85. # complex objects have schema definitions
  86. definitions:
  87. ErrorResponse:
  88. required:
  89. - message
  90. properties:
  91. message:
  92. type: string
  93. GetMoviesListResponse:
  94. required:
  95. - movies
  96. properties:
  97. # The array of movies
  98. movies:
  99. type: array
  100. items:
  101. type: object
  102. properties:
  103. id:
  104. type: string
  105. title:
  106. type: string
  107. year:
  108. type: number
  109. Movie:
  110. type: object
  111. properties:
  112. title:
  113. type: string
  114. description: task object name
  115. year:
  116. type: number
  117. description: task description
  118. required:
  119. - title
  120. - year
  121. GeneralResponse:
  122. type: object
  123. properties:
  124. success:
  125. type: number
  126. description: returns 1 if successful
  127. description:
  128. type: string
  129. description: a short comment
  130. required:
  131. - success
  132. - description
  133. GetMovieResponse:
  134. required:
  135. - id
  136. - title
  137. - year
  138. properties:
  139. id:
  140. type: string
  141. title:
  142. type: string
  143. year:
  144. type: number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement