Switch the validator
A validator checks the data a request carries against the contract. Node servers pick the validator library. The other servers use their framework’s own library and let you change only the rules mode, below. What each stack gets is in Types and validation.
Use this page to change the validator library of the generated code on a Node server, or to make every target give the contract’s exact checks.
The server target reads its validators from the entry its validators link names. In the validators entry of seampact.config.yaml (see Generate the code), change the package.
# seampact.config.yaml, under targets - id: validators use: "@seampact/codegen-yup" apis: [notes]@seampact/codegen-zod and @seampact/codegen-yup work on every Node server. @seampact/codegen-class-validator works on NestJS only. Install the library you pick in your app (yup, or class-validator and class-transformer), then run seampact generate (commands per stack).
You see the validators folder rewritten. On NestJS, Express and Hono, a server without a validators link stops generate with link.missing, which names the packages to link.
Fastify and AdonisJS can skip it: leave out the validators entry and the link, and the server validates with the framework’s own library, Ajv on Fastify and VineJS on AdonisJS. Install ajv or @vinejs/vine in your app.
Native or consistent rules
Section titled “Native or consistent rules”By default the generated validators use the library’s own rules, such as .min(), .uuid() or @IsUUID(). Your library behaves as you know it.
Set rules: seampact-consistent to get the contract’s exact checks instead. Every client, server and language then gives the same answer.
- id: validators use: "@seampact/codegen-yup" apis: [notes] options: rules: seampact-consistentThe error body names the same rule in both modes: minLength, format, pattern, and so on (the 400 body). The option is in Per-target options.
Where the native rules differ from the contract, the page of the library lists it: zod, yup, class-validator and VineJS.
Other servers
Section titled “Other servers”On AdonisJS, Laravel, Symfony and the Python servers, rules sits on the server entry. Each guide’s options table says what it changes: AdonisJS, Laravel, Symfony, FastAPI, DRF, Ninja.
Spring Boot has no rules option: Java records says what it checks.
- Next: OpenAPI and docs.
- What each stack gets: Types and validation.
- Every option: Config reference.