Back

Version 3

6/4/2024
import type { Context } from "npm:hono@3";
import { Hono } from "npm:hono@3";
import { z } from "npm:zod";
import { zodToJsonSchema } from "npm:zod-to-json-schema";

export type HttpVerb = "get" | "post" | "put" | "delete" | "patch";

/**
* Base interface for defining an endpoint.
* This does not include request or response schemas.
*/
export interface EndpointDefBase {
verb: HttpVerb;
path: string;
desc: string;
operationId: string;
}

/**
* Used o define an endpoint with request and response schemas
* along with descriptions for each.
*/
export interface EndpointDefinition extends EndpointDefBase {
requestSchema: z.Schema | null;
requestDesc: string | null;
responseSchema: z.Schema | null;
responseDesc: string | null;
}

/**
* Used to define an input-only endpoint with a request schema,
* but no response schema.
*/
export interface InEndpointDefinition<TRequestSchema extends z.Schema> extends EndpointDefBase {
requestSchema: TRequestSchema;
}
domingo1987-problempython.web.val.run
Updated: June 4, 2024