RustRover cargo-generate template: Axum + Vue 3 + TypeScript + Tailwind + sqlx
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

621 linhas
14 KiB

  1. {
  2. "openapi": "3.1.0",
  3. "info": {
  4. "title": "rust-template",
  5. "description": "Axum API server",
  6. "license": {
  7. "name": "MIT",
  8. "identifier": "MIT"
  9. },
  10. "version": "0.1.0"
  11. },
  12. "paths": {
  13. "/api/v1/items": {
  14. "get": {
  15. "tags": [
  16. "items"
  17. ],
  18. "summary": "List items, newest first.",
  19. "operationId": "list_items",
  20. "parameters": [
  21. {
  22. "name": "page",
  23. "in": "query",
  24. "description": "1-based page index.",
  25. "required": false,
  26. "schema": {
  27. "type": "integer",
  28. "format": "int32",
  29. "minimum": 0
  30. }
  31. },
  32. {
  33. "name": "per_page",
  34. "in": "query",
  35. "description": "Page size (max 100).",
  36. "required": false,
  37. "schema": {
  38. "type": "integer",
  39. "format": "int32",
  40. "minimum": 0
  41. }
  42. }
  43. ],
  44. "responses": {
  45. "200": {
  46. "description": "Paged item list",
  47. "content": {
  48. "application/json": {
  49. "schema": {
  50. "$ref": "#/components/schemas/ItemPage"
  51. }
  52. }
  53. }
  54. }
  55. }
  56. },
  57. "post": {
  58. "tags": [
  59. "items"
  60. ],
  61. "summary": "Create an item.",
  62. "operationId": "create_item",
  63. "requestBody": {
  64. "content": {
  65. "application/json": {
  66. "schema": {
  67. "$ref": "#/components/schemas/CreateItemRequest"
  68. }
  69. }
  70. },
  71. "required": true
  72. },
  73. "responses": {
  74. "201": {
  75. "description": "Created item",
  76. "content": {
  77. "application/json": {
  78. "schema": {
  79. "$ref": "#/components/schemas/ItemResponse"
  80. }
  81. }
  82. }
  83. },
  84. "400": {
  85. "description": "Validation error",
  86. "content": {
  87. "application/json": {
  88. "schema": {
  89. "$ref": "#/components/schemas/ErrorBody"
  90. }
  91. }
  92. }
  93. }
  94. }
  95. }
  96. },
  97. "/api/v1/items/{id}": {
  98. "get": {
  99. "tags": [
  100. "items"
  101. ],
  102. "summary": "Fetch a single item.",
  103. "operationId": "get_item",
  104. "parameters": [
  105. {
  106. "name": "id",
  107. "in": "path",
  108. "description": "Item id",
  109. "required": true,
  110. "schema": {
  111. "type": "string",
  112. "format": "uuid"
  113. }
  114. }
  115. ],
  116. "responses": {
  117. "200": {
  118. "description": "Item",
  119. "content": {
  120. "application/json": {
  121. "schema": {
  122. "$ref": "#/components/schemas/ItemResponse"
  123. }
  124. }
  125. }
  126. },
  127. "404": {
  128. "description": "Missing item",
  129. "content": {
  130. "application/json": {
  131. "schema": {
  132. "$ref": "#/components/schemas/ErrorBody"
  133. }
  134. }
  135. }
  136. }
  137. }
  138. },
  139. "delete": {
  140. "tags": [
  141. "items"
  142. ],
  143. "summary": "Delete an item.",
  144. "operationId": "delete_item",
  145. "parameters": [
  146. {
  147. "name": "id",
  148. "in": "path",
  149. "description": "Item id",
  150. "required": true,
  151. "schema": {
  152. "type": "string",
  153. "format": "uuid"
  154. }
  155. }
  156. ],
  157. "responses": {
  158. "204": {
  159. "description": "Deleted"
  160. },
  161. "404": {
  162. "description": "Missing item",
  163. "content": {
  164. "application/json": {
  165. "schema": {
  166. "$ref": "#/components/schemas/ErrorBody"
  167. }
  168. }
  169. }
  170. }
  171. }
  172. },
  173. "patch": {
  174. "tags": [
  175. "items"
  176. ],
  177. "summary": "Replace selected item fields.",
  178. "operationId": "update_item",
  179. "parameters": [
  180. {
  181. "name": "id",
  182. "in": "path",
  183. "description": "Item id",
  184. "required": true,
  185. "schema": {
  186. "type": "string",
  187. "format": "uuid"
  188. }
  189. }
  190. ],
  191. "requestBody": {
  192. "content": {
  193. "application/json": {
  194. "schema": {
  195. "$ref": "#/components/schemas/UpdateItemRequest"
  196. }
  197. }
  198. },
  199. "required": true
  200. },
  201. "responses": {
  202. "200": {
  203. "description": "Updated item",
  204. "content": {
  205. "application/json": {
  206. "schema": {
  207. "$ref": "#/components/schemas/ItemResponse"
  208. }
  209. }
  210. }
  211. },
  212. "404": {
  213. "description": "Missing item",
  214. "content": {
  215. "application/json": {
  216. "schema": {
  217. "$ref": "#/components/schemas/ErrorBody"
  218. }
  219. }
  220. }
  221. }
  222. }
  223. }
  224. },
  225. "/api/v1/llm/ws": {
  226. "get": {
  227. "tags": [
  228. "llm"
  229. ],
  230. "description": "WebSocket upgrade. After 101, send LlmRequest as one text frame. Server sends LlmWsEvent frames.",
  231. "operationId": "send",
  232. "responses": {
  233. "101": {
  234. "description": "Switching Protocols"
  235. }
  236. }
  237. }
  238. },
  239. "/api/v1/queries/list": {
  240. "get": {
  241. "tags": [
  242. "queries"
  243. ],
  244. "description": "Get all saved queries",
  245. "operationId": "get_queries",
  246. "parameters": [
  247. {
  248. "name": "limit",
  249. "in": "query",
  250. "description": "Maximum number of queries to return",
  251. "required": false,
  252. "schema": {
  253. "type": "integer",
  254. "format": "int64"
  255. }
  256. }
  257. ],
  258. "responses": {
  259. "200": {
  260. "description": "Fetched LLM queries",
  261. "content": {
  262. "application/json": {
  263. "schema": {
  264. "$ref": "#/components/schemas/SavedQueriesResponse"
  265. }
  266. }
  267. }
  268. },
  269. "400": {
  270. "description": "Validation error",
  271. "content": {
  272. "application/json": {
  273. "schema": {
  274. "$ref": "#/components/schemas/ErrorBody"
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }
  281. },
  282. "/api/v1/queries/{id}": {
  283. "get": {
  284. "tags": [
  285. "queries"
  286. ],
  287. "description": "Get a single saved query by ID",
  288. "operationId": "get_query",
  289. "parameters": [
  290. {
  291. "name": "id",
  292. "in": "path",
  293. "required": true,
  294. "schema": {
  295. "type": "string",
  296. "format": "uuid"
  297. }
  298. }
  299. ],
  300. "responses": {
  301. "200": {
  302. "description": "Fetched LLM query",
  303. "content": {
  304. "application/json": {
  305. "schema": {
  306. "$ref": "#/components/schemas/LlmQueryDetail"
  307. }
  308. }
  309. }
  310. },
  311. "400": {
  312. "description": "Validation error",
  313. "content": {
  314. "application/json": {
  315. "schema": {
  316. "$ref": "#/components/schemas/ErrorBody"
  317. }
  318. }
  319. }
  320. },
  321. "404": {
  322. "description": "Query not found",
  323. "content": {
  324. "application/json": {
  325. "schema": {
  326. "$ref": "#/components/schemas/ErrorBody"
  327. }
  328. }
  329. }
  330. }
  331. }
  332. }
  333. },
  334. "/health/live": {
  335. "get": {
  336. "tags": [
  337. "health"
  338. ],
  339. "summary": "Liveness probe. Process is up.",
  340. "operationId": "live",
  341. "responses": {
  342. "200": {
  343. "description": "Process is running",
  344. "content": {
  345. "application/json": {
  346. "schema": {
  347. "$ref": "#/components/schemas/HealthResponse"
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354. },
  355. "/health/ready": {
  356. "get": {
  357. "tags": [
  358. "health"
  359. ],
  360. "summary": "Readiness probe. Database is reachable.",
  361. "operationId": "ready",
  362. "responses": {
  363. "200": {
  364. "description": "Database is reachable",
  365. "content": {
  366. "application/json": {
  367. "schema": {
  368. "$ref": "#/components/schemas/ReadyResponse"
  369. }
  370. }
  371. }
  372. },
  373. "500": {
  374. "description": "Database is unreachable",
  375. "content": {
  376. "application/json": {
  377. "schema": {
  378. "$ref": "#/components/schemas/ErrorBody"
  379. }
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. },
  387. "components": {
  388. "schemas": {
  389. "CreateItemRequest": {
  390. "type": "object",
  391. "required": [
  392. "name"
  393. ],
  394. "properties": {
  395. "description": {
  396. "type": [
  397. "string",
  398. "null"
  399. ]
  400. },
  401. "name": {
  402. "type": "string"
  403. }
  404. }
  405. },
  406. "ErrorBody": {
  407. "type": "object",
  408. "description": "Stable JSON error envelope returned by every handler.",
  409. "required": [
  410. "error"
  411. ],
  412. "properties": {
  413. "error": {
  414. "$ref": "#/components/schemas/ErrorDetail"
  415. }
  416. }
  417. },
  418. "ErrorDetail": {
  419. "type": "object",
  420. "required": [
  421. "status",
  422. "code",
  423. "message"
  424. ],
  425. "properties": {
  426. "code": {
  427. "type": "string"
  428. },
  429. "message": {
  430. "type": "string"
  431. },
  432. "status": {
  433. "type": "integer",
  434. "format": "int32",
  435. "minimum": 0
  436. },
  437. "trace_id": {
  438. "type": [
  439. "string",
  440. "null"
  441. ]
  442. }
  443. }
  444. },
  445. "HealthResponse": {
  446. "type": "object",
  447. "required": [
  448. "status",
  449. "service"
  450. ],
  451. "properties": {
  452. "service": {
  453. "type": "string"
  454. },
  455. "status": {
  456. "type": "string"
  457. }
  458. }
  459. },
  460. "ItemPage": {
  461. "type": "object",
  462. "required": [
  463. "items",
  464. "page",
  465. "per_page",
  466. "total"
  467. ],
  468. "properties": {
  469. "items": {
  470. "type": "array",
  471. "items": {
  472. "$ref": "#/components/schemas/ItemResponse"
  473. }
  474. },
  475. "page": {
  476. "type": "integer",
  477. "format": "int32",
  478. "minimum": 0
  479. },
  480. "per_page": {
  481. "type": "integer",
  482. "format": "int32",
  483. "minimum": 0
  484. },
  485. "total": {
  486. "type": "integer",
  487. "format": "int64"
  488. }
  489. }
  490. },
  491. "ItemResponse": {
  492. "type": "object",
  493. "required": [
  494. "id",
  495. "name",
  496. "created_at",
  497. "updated_at"
  498. ],
  499. "properties": {
  500. "created_at": {
  501. "type": "string",
  502. "format": "date-time"
  503. },
  504. "description": {
  505. "type": [
  506. "string",
  507. "null"
  508. ]
  509. },
  510. "id": {
  511. "type": "string",
  512. "format": "uuid"
  513. },
  514. "name": {
  515. "type": "string"
  516. },
  517. "updated_at": {
  518. "type": "string",
  519. "format": "date-time"
  520. }
  521. }
  522. },
  523. "LlmQuery": {
  524. "type": "object",
  525. "required": [
  526. "id",
  527. "title"
  528. ],
  529. "properties": {
  530. "id": {
  531. "type": "string",
  532. "format": "uuid"
  533. },
  534. "title": {
  535. "type": "string"
  536. }
  537. }
  538. },
  539. "LlmQueryDetail": {
  540. "type": "object",
  541. "required": [
  542. "id",
  543. "title",
  544. "messages"
  545. ],
  546. "properties": {
  547. "id": {
  548. "type": "string",
  549. "format": "uuid"
  550. },
  551. "messages": {
  552. "type": "array",
  553. "items": {
  554. "type": "string"
  555. }
  556. },
  557. "title": {
  558. "type": "string"
  559. }
  560. }
  561. },
  562. "ReadyResponse": {
  563. "type": "object",
  564. "required": [
  565. "status",
  566. "database"
  567. ],
  568. "properties": {
  569. "database": {
  570. "type": "string"
  571. },
  572. "status": {
  573. "type": "string"
  574. }
  575. }
  576. },
  577. "SavedQueriesResponse": {
  578. "type": "object",
  579. "required": [
  580. "queries"
  581. ],
  582. "properties": {
  583. "queries": {
  584. "type": "array",
  585. "items": {
  586. "$ref": "#/components/schemas/LlmQuery"
  587. }
  588. }
  589. }
  590. },
  591. "UpdateItemRequest": {
  592. "type": "object",
  593. "properties": {
  594. "description": {
  595. "type": [
  596. "string",
  597. "null"
  598. ]
  599. },
  600. "name": {
  601. "type": [
  602. "string",
  603. "null"
  604. ]
  605. }
  606. }
  607. }
  608. }
  609. },
  610. "tags": [
  611. {
  612. "name": "health",
  613. "description": "Liveness and readiness"
  614. },
  615. {
  616. "name": "items",
  617. "description": "Example CRUD resource"
  618. }
  619. ]
  620. }