hono-ban
Version:
HTTP-friendly error objects for Hono, inspired by Boom
163 lines (162 loc) • 4.05 kB
TypeScript
/**
* Zod schemas for RFC 7807 Problem Details
* @module hono-ban/formatters/rfc7807/schemas
*/
import { z } from "@hono/zod-openapi";
/**
* Schema for RFC 7807 validation error parameters
*/
export declare const RFC7807ValidationParamSchema: z.ZodObject<{
name: z.ZodString;
reason: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
reason: string;
}, {
name: string;
reason: string;
}>;
/**
* Schema for RFC 7807 constraint violations
*/
export declare const RFC7807ConstraintViolationSchema: z.ZodObject<{
name: z.ZodString;
reason: z.ZodString;
resource: z.ZodString;
constraint: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
reason: string;
resource: string;
constraint: string;
}, {
name: string;
reason: string;
resource: string;
constraint: string;
}>;
/**
* Schema for additional error data in RFC 7807 problem details
*/
export declare const RFC7807ErrorDataSchema: z.ZodObject<{
"invalid-params": z.ZodOptional<z.ZodArray<z.ZodObject<{
name: z.ZodString;
reason: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
reason: string;
}, {
name: string;
reason: string;
}>, "many">>;
violations: z.ZodOptional<z.ZodArray<z.ZodObject<{
name: z.ZodString;
reason: z.ZodString;
resource: z.ZodString;
constraint: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
reason: string;
resource: string;
constraint: string;
}, {
name: string;
reason: string;
resource: string;
constraint: string;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
"invalid-params"?: {
name: string;
reason: string;
}[] | undefined;
violations?: {
name: string;
reason: string;
resource: string;
constraint: string;
}[] | undefined;
}, {
"invalid-params"?: {
name: string;
reason: string;
}[] | undefined;
violations?: {
name: string;
reason: string;
resource: string;
constraint: string;
}[] | undefined;
}>;
/**
* Schema for complete RFC 7807 problem details
*/
export declare const RFC7807DetailsSchema: z.ZodObject<z.objectUtil.extendShape<{
type: z.ZodString;
title: z.ZodString;
status: z.ZodNumber;
detail: z.ZodOptional<z.ZodString>;
instance: z.ZodOptional<z.ZodString>;
timestamp: z.ZodOptional<z.ZodString>;
}, {
"invalid-params": z.ZodOptional<z.ZodArray<z.ZodObject<{
name: z.ZodString;
reason: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
reason: string;
}, {
name: string;
reason: string;
}>, "many">>;
violations: z.ZodOptional<z.ZodArray<z.ZodObject<{
name: z.ZodString;
reason: z.ZodString;
resource: z.ZodString;
constraint: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
reason: string;
resource: string;
constraint: string;
}, {
name: string;
reason: string;
resource: string;
constraint: string;
}>, "many">>;
}>, "strip", z.ZodTypeAny, {
type: string;
title: string;
status: number;
"invalid-params"?: {
name: string;
reason: string;
}[] | undefined;
violations?: {
name: string;
reason: string;
resource: string;
constraint: string;
}[] | undefined;
detail?: string | undefined;
instance?: string | undefined;
timestamp?: string | undefined;
}, {
type: string;
title: string;
status: number;
"invalid-params"?: {
name: string;
reason: string;
}[] | undefined;
violations?: {
name: string;
reason: string;
resource: string;
constraint: string;
}[] | undefined;
detail?: string | undefined;
instance?: string | undefined;
timestamp?: string | undefined;
}>;