Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ import z from "zod";
const app = Fastify()

// Add schema validator and serializer
app.setValidatorCompiler(validatorCompiler);
app.setSerializerCompiler(serializerCompiler);
//You can precise a function to handle the case where schema is not from Zod.
//The function should respect : (schema: unknown, data: unknown) => FastifyValidationResult
//By default, it will try to use AJV if not precised
app.setValidatorCompiler(validatorCompiler());

app.withTypeProvider<ZodTypeProvider>().route({
method: "GET",
Expand Down Expand Up @@ -54,7 +57,7 @@ import {
} from 'fastify-type-provider-zod';

const app = fastify();
app.setValidatorCompiler(validatorCompiler);
app.setValidatorCompiler(validatorCompiler());
app.setSerializerCompiler(serializerCompiler);

app.register(fastifySwagger, {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"fastify": "^4.24.3",
"graphql": "^16.8.1",
"jest": "^29.7.0",
"mercurius": "^13.0.0",
"oas-validator": "^5.0.8",
"prettier": "^2.7.1",
"ts-jest": "^29.1.1",
Expand Down
Loading