Skip to main content

Variable: commonErrorResponses

const commonErrorResponses: object

Defined in: src/api/schemas/error.ts:149

Common error responses for OpenAPI documentation.

Type declaration

400

readonly 400: object

400.content

readonly content: object

400.content.application/json

readonly application/json: object

400.content.application/json.schema

readonly schema: ZodObject<{ error: ZodObject<{ code: ZodLiteral<"VALIDATION_ERROR">; field: ZodString; message: ZodString; requestId: ZodString; retryAfter: ZodOptional<ZodNumber>; }, $strip>; }, $strip> = validationErrorSchema

400.description

readonly description: "Bad Request - Validation error" = 'Bad Request - Validation error'

401

readonly 401: object

401.content

readonly content: object

401.content.application/json

readonly application/json: object

401.content.application/json.schema

readonly schema: ZodObject<{ error: ZodObject<{ code: ZodLiteral<"AUTHENTICATION_ERROR">; field: ZodOptional<ZodString>; message: ZodString; requestId: ZodString; retryAfter: ZodOptional<ZodNumber>; }, $strip>; }, $strip> = authenticationErrorSchema

401.description

readonly description: "Unauthorized - Authentication required" = 'Unauthorized - Authentication required'

403

readonly 403: object

403.content

readonly content: object

403.content.application/json

readonly application/json: object

403.content.application/json.schema

readonly schema: ZodObject<{ error: ZodObject<{ code: ZodLiteral<"AUTHORIZATION_ERROR">; field: ZodOptional<ZodString>; message: ZodString; requestId: ZodString; retryAfter: ZodOptional<ZodNumber>; }, $strip>; }, $strip> = authorizationErrorSchema

403.description

readonly description: "Forbidden - Insufficient permissions" = 'Forbidden - Insufficient permissions'

404

readonly 404: object

404.content

readonly content: object

404.content.application/json

readonly application/json: object

404.content.application/json.schema

readonly schema: ZodObject<{ error: ZodObject<{ code: ZodLiteral<"NOT_FOUND">; field: ZodOptional<ZodString>; message: ZodString; requestId: ZodString; retryAfter: ZodOptional<ZodNumber>; }, $strip>; }, $strip> = notFoundErrorSchema

404.description

readonly description: "Not Found - Resource not found" = 'Not Found - Resource not found'

429

readonly 429: object

429.content

readonly content: object

429.content.application/json

readonly application/json: object

429.content.application/json.schema

readonly schema: ZodObject<{ error: ZodObject<{ code: ZodLiteral<"RATE_LIMIT_EXCEEDED">; field: ZodOptional<ZodString>; message: ZodString; requestId: ZodString; retryAfter: ZodNumber; }, $strip>; }, $strip> = rateLimitErrorSchema

429.description

readonly description: "Too Many Requests - Rate limit exceeded" = 'Too Many Requests - Rate limit exceeded'

500

readonly 500: object

500.content

readonly content: object

500.content.application/json

readonly application/json: object

500.content.application/json.schema

readonly schema: ZodObject<{ error: ZodObject<{ code: ZodEnum<{ COMPLIANCE_VIOLATION: "COMPLIANCE_VIOLATION"; DATABASE_ERROR: "DATABASE_ERROR"; INTERNAL_ERROR: "INTERNAL_ERROR"; }>; field: ZodOptional<ZodString>; message: ZodString; requestId: ZodString; retryAfter: ZodOptional<ZodNumber>; }, $strip>; }, $strip> = internalErrorSchema

500.description

readonly description: "Internal Server Error" = 'Internal Server Error'

Remarks

Use these in route definitions for consistent error documentation.

Example

const route = createRoute({
// ...
responses: {
200: { ... },
...commonErrorResponses,
},
});