This library offers the
schema
helper, which offers all methods from the main API but will output JSON Schema compatible schemas. So you can use it with Fastify:
const fastify = require('fastify')() const { schema: { object, string } } = require('jsontypedef') const schema = { headers: object({ 'x-foo': string() }), } fastify.post('/the/url', { schema }, (req, reply) => { reply.send('ok') })