Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot generate multiple documents. #839

Open
2 tasks done
aurelienbobenrieth opened this issue Nov 14, 2024 · 0 comments
Open
2 tasks done

Cannot generate multiple documents. #839

aurelienbobenrieth opened this issue Nov 14, 2024 · 0 comments

Comments

@aurelienbobenrieth
Copy link

aurelienbobenrieth commented Nov 14, 2024

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant