Advertisement
Guest User

Untitled

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