Openstatus www.openstatus.dev
at 4c0f4c00a38753a5d0dfd7e7b7b7706dec6f1503 69 lines 2.0 kB view raw
1import type { RouteConfig } from "@hono/zod-openapi"; 2import { createErrorSchema } from "./utils"; 3 4export const openApiErrorResponses = { 5 400: { 6 description: 7 "The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).", 8 content: { 9 "application/json": { 10 schema: createErrorSchema("BAD_REQUEST").openapi("ErrBadRequest"), 11 }, 12 }, 13 }, 14 401: { 15 description: 16 "The client must authenticate itself to get the requested response.", 17 content: { 18 "application/json": { 19 schema: createErrorSchema("UNAUTHORIZED").openapi("ErrUnauthorized"), 20 }, 21 }, 22 }, 23 402: { 24 description: "A higher pricing plan is required to access the resource.", 25 content: { 26 "application/json": { 27 schema: 28 createErrorSchema("PAYMENT_REQUIRED").openapi("ErrPaymentRequired"), 29 }, 30 }, 31 }, 32 403: { 33 description: 34 "The client does not have the necessary permissions to access the resource.", 35 content: { 36 "application/json": { 37 schema: createErrorSchema("FORBIDDEN").openapi("ErrForbidden"), 38 }, 39 }, 40 }, 41 404: { 42 description: "The server can't find the requested resource.", 43 content: { 44 "application/json": { 45 schema: createErrorSchema("NOT_FOUND").openapi("ErrNotFound"), 46 }, 47 }, 48 }, 49 409: { 50 description: 51 "The request could not be completed due to a conflict mainly due to unique constraints.", 52 content: { 53 "application/json": { 54 schema: createErrorSchema("CONFLICT").openapi("ErrConflict"), 55 }, 56 }, 57 }, 58 500: { 59 description: 60 "The server has encountered a situation it doesn't know how to handle.", 61 content: { 62 "application/json": { 63 schema: createErrorSchema("INTERNAL_SERVER_ERROR").openapi( 64 "ErrInternalServerError", 65 ), 66 }, 67 }, 68 }, 69} satisfies RouteConfig["responses"];