express-zod-api
Advanced tools
Changelog
v3.1.1
Changelog
v3.0.0
ConfigType
removed — please use createConfig()
instead.Changelog
v2.10.0
withMeta()
. You can wrap any Zod schema in it, for example: withMeta(z.string())
;withMeta()
provides you with additional methods for generated documentation. At the moment there is one so far:
withMeta().example()
;.example()
multiple times for specifying several examples for your schema;withMeta()
can be used within Endpoint and Middleware as well. Their input examples will be merged for the
generated documentation;example
folder;withMeta()
mutates its argument;import { defaultEndpointsFactory } from "express-zod-api";
const exampleEndpoint = defaultEndpointsFactory.build({
method: "post",
description: "example user update endpoint",
input: withMeta(
z.object({
id: z.number().int().nonnegative(),
name: z.string().nonempty(),
}),
).example({
id: 12,
name: "John Doe",
}),
output: withMeta(
z.object({
name: z.string(),
timestamp: z.number().int().nonnegative(),
}),
).example({
name: "John Doe",
timestamp: 1235698995125,
}),
handler: async () => {},
});
Changelog
v2.9.0
z.string().describe('Something')
.
example:
parameters:
- name: id
in: query
required: true
schema:
description: a numeric string containing the id of the user
type: string
pattern: /\d+/
Changelog
v2.8.1
yarn
does NOT respect yarn.lock
files of sub-dependencies. So the
version of zod
defined in my yarn.lock
file does not actually mean anything when doing yarn add express-zod-api
.
package.json
file from now on.npm
users are also affected since the distributed lock file is for yarn
.