openapi-happy-path.json 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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": [
  97. "admin",
  98. "member"
  99. ]
  100. }
  101. },
  102. "required": [
  103. "name",
  104. "email"
  105. ],
  106. "additionalProperties": false
  107. }
  108. }
  109. }
  110. },
  111. "responses": {
  112. "201": {
  113. "description": "Created",
  114. "content": {
  115. "application/vnd.example+json": {
  116. "schema": {
  117. "$ref": "#/components/schemas/User"
  118. }
  119. }
  120. }
  121. }
  122. }
  123. }
  124. },
  125. "/search": {
  126. "get": {
  127. "operationId": "search.run",
  128. "summary": "Search users",
  129. "security": [],
  130. "parameters": [
  131. {
  132. "name": "filter",
  133. "in": "query",
  134. "style": "deepObject",
  135. "explode": true,
  136. "schema": {
  137. "type": "object",
  138. "properties": {
  139. "query": {
  140. "type": "string"
  141. },
  142. "page": {
  143. "type": "integer"
  144. }
  145. },
  146. "required": [
  147. "query"
  148. ],
  149. "additionalProperties": false
  150. }
  151. },
  152. {
  153. "name": "tags",
  154. "in": "query",
  155. "style": "form",
  156. "explode": true,
  157. "schema": {
  158. "type": "array",
  159. "items": {
  160. "type": "string"
  161. }
  162. }
  163. }
  164. ],
  165. "responses": {
  166. "200": {
  167. "description": "Summary",
  168. "content": {
  169. "text/plain": {
  170. "schema": {
  171. "type": "string"
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. }
  179. },
  180. "components": {
  181. "parameters": {
  182. "UserId": {
  183. "name": "userId",
  184. "in": "path",
  185. "required": true,
  186. "schema": {
  187. "type": "string"
  188. }
  189. }
  190. },
  191. "responses": {
  192. "UserResponse": {
  193. "description": "A user",
  194. "content": {
  195. "application/json": {
  196. "schema": {
  197. "$ref": "#/components/schemas/User"
  198. }
  199. }
  200. }
  201. }
  202. },
  203. "schemas": {
  204. "User": {
  205. "type": "object",
  206. "properties": {
  207. "id": {
  208. "type": "string"
  209. },
  210. "name": {
  211. "type": "string"
  212. },
  213. "email": {
  214. "type": "string",
  215. "format": "email"
  216. },
  217. "role": {
  218. "type": "string",
  219. "enum": [
  220. "admin",
  221. "member"
  222. ]
  223. }
  224. },
  225. "required": [
  226. "id",
  227. "name",
  228. "email"
  229. ],
  230. "additionalProperties": false
  231. }
  232. },
  233. "securitySchemes": {
  234. "BearerAuth": {
  235. "type": "http",
  236. "scheme": "bearer"
  237. },
  238. "ApiKey": {
  239. "type": "apiKey",
  240. "in": "query",
  241. "name": "api_key"
  242. }
  243. }
  244. }
  245. }