SkeLLLa/fastify-oas

FastifySchema is not correct when using Fastify 3.x

Opened this issue · 0 comments

export const opts: RouteShorthandOptions = {
  schema: {
    tags: ["organization"],
    params: baseParamsSchema,    
    response: {
      200: organizationSchema,
    },
  },
 
  preValidation: [],
  preHandler: [],
};

results in

Type
{ tags: string[]; 
    params: { 
      description: string; 
      type: string; 
      properties: { 
          organizationId: {    
              type: string; 
              title: 
              string; 
          }; 
      }; 
    required: string[]; $schema: string; };
    response: { 
        200: { 
            description: string; 
            type: string; 
            properties: { ...; };
            required: string[]; 
            $schema: string; 
          
        }; 
      
    }; 
}
is not assignable to type 'FastifySchema'.
Object literal may only specify known properties, 
and 'tags' does not exist in type 'FastifySchema'.

But tags is a part of schema in fastify 3.x, can u resolve? To circumvent I am using @ts-ignore

Context
node version: v15.12.0
fastify version: >=^3.14.0
fastify-oas: ^3.0.8
os: Windows, Ubuntu WSL