openapi-happy-path.json 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. {
  2. "openapi": "3.1.0",
  3. "info": {
  4. "title": "CodeMode Happy Path",
  5. "version": "1.0.0"
  6. },
  7. "servers": [
  8. {
  9. "url": "https://api.example.test/v1"
  10. }
  11. ],
  12. "security": [
  13. {
  14. "BearerAuth": []
  15. }
  16. ],
  17. "paths": {
  18. "/users/{userId}": {
  19. "parameters": [
  20. {
  21. "$ref": "#/components/parameters/UserId"
  22. }
  23. ],
  24. "get": {
  25. "operationId": "users.get",
  26. "summary": "Get a user",
  27. "parameters": [
  28. {
  29. "name": "include",
  30. "in": "query",
  31. "style": "form",
  32. "explode": false,
  33. "schema": {
  34. "type": "array",
  35. "items": {
  36. "type": "string"
  37. }
  38. }
  39. },
  40. {
  41. "name": "verbose",
  42. "in": "query",
  43. "schema": {
  44. "type": "boolean"
  45. }
  46. },
  47. {
  48. "name": "X-Trace-ID",
  49. "in": "header",
  50. "schema": {
  51. "type": "string"
  52. }
  53. }
  54. ],
  55. "responses": {
  56. "200": {
  57. "$ref": "#/components/responses/UserResponse"
  58. }
  59. }
  60. },
  61. "delete": {
  62. "operationId": "users.remove",
  63. "summary": "Remove a user",
  64. "responses": {
  65. "204": {
  66. "description": "Removed"
  67. }
  68. }
  69. }
  70. },
  71. "/users": {
  72. "post": {
  73. "operationId": "users.create",
  74. "summary": "Create a user",
  75. "security": [
  76. {
  77. "ApiKey": []
  78. }
  79. ],
  80. "requestBody": {
  81. "required": true,
  82. "content": {
  83. "application/json": {
  84. "schema": {
  85. "type": "object",
  86. "properties": {
  87. "name": {
  88. "type": "string"
  89. },
  90. "email": {
  91. "type": "string",
  92. "format": "email"
  93. },
  94. "role": {
  95. "type": "string",
  96. "enum": ["admin", "member"]
  97. }
  98. },
  99. "required": ["name", "email"],
  100. "additionalProperties": false
  101. }
  102. }
  103. }
  104. },
  105. "responses": {
  106. "201": {
  107. "description": "Created",
  108. "content": {
  109. "application/vnd.example+json": {
  110. "schema": {
  111. "$ref": "#/components/schemas/User"
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. },
  119. "/search": {
  120. "get": {
  121. "operationId": "search.run",
  122. "summary": "Search users",
  123. "security": [],
  124. "parameters": [
  125. {
  126. "name": "filter",
  127. "in": "query",
  128. "style": "deepObject",
  129. "explode": true,
  130. "schema": {
  131. "type": "object",
  132. "properties": {
  133. "query": {
  134. "type": "string"
  135. },
  136. "page": {
  137. "type": "integer"
  138. }
  139. },
  140. "required": ["query"],
  141. "additionalProperties": false
  142. }
  143. },
  144. {
  145. "name": "tags",
  146. "in": "query",
  147. "style": "form",
  148. "explode": true,
  149. "schema": {
  150. "type": "array",
  151. "items": {
  152. "type": "string"
  153. }
  154. }
  155. }
  156. ],
  157. "responses": {
  158. "200": {
  159. "description": "Summary",
  160. "content": {
  161. "text/plain": {
  162. "schema": {
  163. "type": "string"
  164. }
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }
  171. },
  172. "components": {
  173. "parameters": {
  174. "UserId": {
  175. "name": "userId",
  176. "in": "path",
  177. "required": true,
  178. "schema": {
  179. "type": "string"
  180. }
  181. }
  182. },
  183. "responses": {
  184. "UserResponse": {
  185. "description": "A user",
  186. "content": {
  187. "application/json": {
  188. "schema": {
  189. "$ref": "#/components/schemas/User"
  190. }
  191. }
  192. }
  193. }
  194. },
  195. "schemas": {
  196. "User": {
  197. "type": "object",
  198. "properties": {
  199. "id": {
  200. "type": "string"
  201. },
  202. "name": {
  203. "type": "string"
  204. },
  205. "email": {
  206. "type": "string",
  207. "format": "email"
  208. },
  209. "role": {
  210. "type": "string",
  211. "enum": ["admin", "member"]
  212. }
  213. },
  214. "required": ["id", "name", "email"],
  215. "additionalProperties": false
  216. }
  217. },
  218. "securitySchemes": {
  219. "BearerAuth": {
  220. "type": "http",
  221. "scheme": "bearer"
  222. },
  223. "ApiKey": {
  224. "type": "apiKey",
  225. "in": "query",
  226. "name": "api_key"
  227. }
  228. }
  229. }
  230. }