Skip to content

v1.2.0

Compare
Choose a tag to compare
@samchungy samchungy released this 07 Mar 10:38
· 92 commits to main since this release
fee2624

What's Changed

New Features 🎉

  • Add Fastify Plugin Signatures by @samchungy, @Puppo in #99

    This allows you to declare your routes with more modularity eg.

    const plugin: FastifyPluginAsyncZodOpenApi = async (fastify, _opts) => {
      fastify.route({
        method: 'POST',
        url: '/',
        // Define your schema
        schema: {
          body: z.object({
            jobId: z.string().openapi({
              description: 'Job ID',
              example: '60002023',
            }),
          }),
          response: {
            201: z.object({
              jobId: z.string().openapi({
                description: 'Job ID',
                example: '60002023',
              }),
            }),
          },
        } satisfies FastifyZodOpenApiSchema,
        handler: async (req, res) => {
          await res.send({ jobId: req.body.jobId });
        },
      });
    };
    app.register(plugin);

Full Changelog: v1.1.0...v1.2.0