Variable: commonErrorResponses
constcommonErrorResponses:object
Defined in: src/api/schemas/error.ts:149
Common error responses for OpenAPI documentation.
Type declaration
400
readonly400:object
400.content
readonlycontent:object
400.content.application/json
readonlyapplication/json:object
400.content.application/json.schema
readonlyschema:ZodObject<{error:ZodObject<{code:ZodLiteral<"VALIDATION_ERROR">;field:ZodString;message:ZodString;requestId:ZodString;retryAfter:ZodOptional<ZodNumber>; },$strip>; },$strip> =validationErrorSchema
400.description
readonlydescription:"Bad Request - Validation error"='Bad Request - Validation error'
401
readonly401:object
401.content
readonlycontent:object
401.content.application/json
readonlyapplication/json:object
401.content.application/json.schema
readonlyschema:ZodObject<{error:ZodObject<{code:ZodLiteral<"AUTHENTICATION_ERROR">;field:ZodOptional<ZodString>;message:ZodString;requestId:ZodString;retryAfter:ZodOptional<ZodNumber>; },$strip>; },$strip> =authenticationErrorSchema
401.description
readonlydescription:"Unauthorized - Authentication required"='Unauthorized - Authentication required'
403
readonly403:object
403.content
readonlycontent:object
403.content.application/json
readonlyapplication/json:object
403.content.application/json.schema
readonlyschema:ZodObject<{error:ZodObject<{code:ZodLiteral<"AUTHORIZATION_ERROR">;field:ZodOptional<ZodString>;message:ZodString;requestId:ZodString;retryAfter:ZodOptional<ZodNumber>; },$strip>; },$strip> =authorizationErrorSchema
403.description
readonlydescription:"Forbidden - Insufficient permissions"='Forbidden - Insufficient permissions'
404
readonly404:object
404.content
readonlycontent:object
404.content.application/json
readonlyapplication/json:object
404.content.application/json.schema
readonlyschema:ZodObject<{error:ZodObject<{code:ZodLiteral<"NOT_FOUND">;field:ZodOptional<ZodString>;message:ZodString;requestId:ZodString;retryAfter:ZodOptional<ZodNumber>; },$strip>; },$strip> =notFoundErrorSchema
404.description
readonlydescription:"Not Found - Resource not found"='Not Found - Resource not found'
429
readonly429:object
429.content
readonlycontent:object
429.content.application/json
readonlyapplication/json:object
429.content.application/json.schema
readonlyschema:ZodObject<{error:ZodObject<{code:ZodLiteral<"RATE_LIMIT_EXCEEDED">;field:ZodOptional<ZodString>;message:ZodString;requestId:ZodString;retryAfter:ZodNumber; },$strip>; },$strip> =rateLimitErrorSchema
429.description
readonlydescription:"Too Many Requests - Rate limit exceeded"='Too Many Requests - Rate limit exceeded'
500
readonly500:object
500.content
readonlycontent:object
500.content.application/json
readonlyapplication/json:object
500.content.application/json.schema
readonlyschema: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
readonlydescription:"Internal Server Error"='Internal Server Error'
Remarks
Use these in route definitions for consistent error documentation.
Example
const route = createRoute({
// ...
responses: {
200: { ... },
...commonErrorResponses,
},
});