Skip to content

Fastify 3.x how to tag my routes ? To be visible in sections under swagger in fastify-oas #394

Closed
@andersakerberg

Description

@andersakerberg

Hello,

First let me start out with thanking you for your awesomeness , I love everything you do!

I am coming from fastify 2.x and was using fastify-oas to structure my swagger documentation, I have now tried to migrate to fastify 3.x and trying to acheive the same outcome here, is it possible? What am I doing wrong ? :)

from routes/organization/getOrganization

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

from server.ts

server.register(swagger, {
  routePrefix: "/docs",
  exposeRoute: true,
  swagger: {
    basePath: "/",
    info: {
      title: "Marketeer core swagger",
      version: pj.version,
      description: swaggerDescription,
    },

    host: "localhost",
    schemes: ["http"],
    consumes: ["application/json"],
    produces: ["application/json"],
    definitions: getSwaggerDefinitions(),
    securityDefinitions: {
      JWT: {
        type: "http",
        scheme: "bearer",
        bearerFormat: "jwt",
      },
    },
    tags: [{ name: "organization" }],
  },
  uiConfig: {
    docExpansion: "full",
    deepLinking: false,
  },
});

What was the result you received?

They dont get folder within their respective tags

What did you expect?

I want my routes to be folded under their respective tags

Context

  • node version: v15.12.0
  • fastify version: >=^3.14.0
    • fastify-oas: ^3.0.8
  • os: Windows, Ubuntu WSL
    Please read this entire template before posting any issue. If you ignore these instructions
    and post an issue here that does not follow the instructions, your issue might be closed,
    locked, and assigned the missing discussion label.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions