Swagger: Fastify

Created on 7 Jun 2018  路  7Comments  路  Source: nestjs/swagger

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

In response to this: https://github.com/nestjs/nest/issues/727.

To implement this were you thinking of using https://github.com/fastify/fastify-swagger? Or is there another plan? Wondering if I could take a chance at setting something up. Looking for some guidance first though.

bug feature

Most helpful comment

@kamilmysliwiec, thanks a lot for the Feature! I gave it a test today and I saw a couple of issues:

  1. Locks in the right side (when authorization is enabled for the endpoint) are gone
  2. Query parameters (@Param) do not appear to be filled in the endpoints
  3. @ApiUseTags() seems to not to work as all the endpoints are inside the same group

When rendering them using express, it works as expected. Using exactly the same app/config and just swapping to fastify I can find the previous errors.

Would you like me to create a new issue or maybe this can be tracked in this issue? I guess there must be some differences between the express and fastify implementation of the swagger docs, or I'm not sure...

All 7 comments

I'm guessing that we'll use fastify-swagger. Feel free to create a pull request 馃檪

Fastify integration is available since v2.2.0 release 馃檳鉂わ笍

@kamilmysliwiec, thanks a lot for the Feature! I gave it a test today and I saw a couple of issues:

  1. Locks in the right side (when authorization is enabled for the endpoint) are gone
  2. Query parameters (@Param) do not appear to be filled in the endpoints
  3. @ApiUseTags() seems to not to work as all the endpoints are inside the same group

When rendering them using express, it works as expected. Using exactly the same app/config and just swapping to fastify I can find the previous errors.

Would you like me to create a new issue or maybe this can be tracked in this issue? I guess there must be some differences between the express and fastify implementation of the swagger docs, or I'm not sure...

i also see about issues. My NPM packages are up to date.

We're blocked by this issue https://github.com/fastify/fastify-swagger/issues/97 now.
A possible workaround would be to temporarly create a file using generated specification, in this way:

const swaggerFile = 'swagger.json';
fs.writeFileSync(swaggerFile, JSON.stringify(document));
httpServer.register(fastifySwagger, {
      swagger: document,
      exposeRoute: true,
      routePrefix: path,
      mode: 'static',
      specification: {
        path: swaggerFile,
      },
});

My PR to fastify-swagger is merged already. v2.4.2 of @nestjs/swagger is available as well.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericzon picture ericzon  路  4Comments

otroboe picture otroboe  路  3Comments

patilrevansidh picture patilrevansidh  路  4Comments

mogusbi picture mogusbi  路  3Comments

taipoxin picture taipoxin  路  4Comments