darto_zard_openapi 1.0.0
darto_zard_openapi: ^1.0.0 copied to clipboard
Hono-style zod-openapi for Darto — define a zard schema once to validate requests and generate the OpenAPI 3.1 document, with OpenAPIDarto, createRoute and Scalar UI.
1.0.0 #
- Initial release. Hono-style
zod-openapifor Darto:OpenAPIDarto(darto)— a composable plugin that wraps your ownDarto, withopenapi(route, middlewares, handler)anddoc(path, info:, servers:). Plain routes/middleware andlistenstay on theDartoyou pass in.createRoute({method, path, request, responses})— a reusable route contract, decoupled from the handler.Req(json:, params:, query:, headers:)/Res(status, description, body:)accept zard schemas bridged with.openapiSchema([name])..openapi({example, description})extension on zardSchema<T>— attaches field metadata;exampleis type-checked against the schema's type (z.int()→int,z.string()→String), and stays correct throughz.coerce.*/transform..openapiSchema([name])extension on zardSchema— names a reusable component (#/components/schemas/<name>, referenced via$ref) or inlines it.scalarUI(url:)— serves the Scalar API reference UI.- Validation is performed by the zard schemas (via Darto's
validatormiddleware): full zard power (email/refine/coerce/custom messages), with the same schema feeding the generated OpenAPI 3.1 document.