Skip to content

Cannot generate multiple documents. #839

@aurelienbobenrieth

Description

@aurelienbobenrieth

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

I spent hours trying to figure out myself, but I cannot seem to manage to generate multiple documents.

With this:

const generateOpenApiDocumentation =
  (server: Server) => async (version: string) => {
    const { name, baseUrl } = AppConfig;
    await server.register(FastifySwagger.fastifySwagger, {
      openapi: {
        info: {
          title: `${name} API`,
          version,
        },
        servers: [/* ... */],
      },
      prefix: `/api/${version}`,
    });
  };
  
// ...

for (const version of PUBLISHED_VERSIONS) {
  await generateOpenApiDocumentation(server)(version);
}

I get : FST_ERR_DEC_ALREADY_PRESENT: The decorator "swagger" has already been added.

If I use encapsulation as described here:
#213

Then both of my generated documents have no routes...

Isn't it possible to have the auto mode with encapsulation ?

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