v1.14.0 — schema enum/nullable/default builders
Added
-
s.enum,s.nullable,s.default, ands.literalschema builders. The
shelper can now express value-level facets that previously had nowhere to
live in aSchemaNode:defineRoute(handler, { request: { body: s.object({ role: s.enum(['admin', 'user', 'guest']), status: s.nullable(s.enum(['active', 'inactive'])), limit: s.default(s.number(), 20), kind: s.literal('user'), }), }, });
These flow through to the exported OpenAPI document, the docs UI schema tree,
and every request example (Copy as cURL, Postman export, mock server).
Fixed
-
defineRoutenow emitsenumandnullable.SchemaNodecould only
carrytype/properties/items/optional, so enum members and
nullability were dropped before reaching the OpenAPI export or docs UI —
z.enum([...])collapsed to a barestringand.nullable()was demoted to
optional. Both thesbuilder and the Zod converter now preserve them, and
the exporter emitsenumplus OpenAPI 3.1type: [<type>, 'null']. -
Default values are now applied in request examples. A schema
default
(vias.default(...)or Zod.default(...)) is emitted to OpenAPI and seeds
the generated request bodies and query parameters used by Copy as cURL, the
Postman export, and the mock server. Fields with a default are treated as
optional and excluded fromrequired.