swagger icon indicating copy to clipboard operation
swagger copied to clipboard

Make JSON endpoint customizable using an option variable

Open jcolladosp opened this issue 2 years ago • 7 comments

Is there an existing issue that is already proposing this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe it

Hi, I have been looking into the issues and docs but I think that the feature i'm requesting is not available and it can be useful for me and other people.

Right now the swagger json is deployed in ${finalPath}-json, for example: http://localhost:3000/api-json

Describe the solution you'd like

I would like to have the json full path customizable, for example, instead of being /api-json, I would like to have: /api-docs

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

That's because we have more applications with the swagger json served in that path.

Thanks in advance

jcolladosp avatar Jul 11 '22 11:07 jcolladosp

Would you like to create a PR for this?

kamilmysliwiec avatar Jul 12 '22 06:07 kamilmysliwiec

@jcolladosp You working on PR ?

tushar1998 avatar Jul 15 '22 16:07 tushar1998

Hi @Tushar1998 and @kamilmysliwiec I would try to work on a PR during next week. Thanks for your time

jcolladosp avatar Jul 16 '22 17:07 jcolladosp

Hi @tushar1998 , I'm starting to work on the PR. Where do you think I should add the new parameter to specify the path name for the json? Should it be in SwaggerDocumentOptions or in SwaggerCustomOptions of the setup function?

Thanks

jcolladosp avatar Aug 05 '22 11:08 jcolladosp

Hi @jcolladosp, If you look closely serveDocuments private method is reponsible to serve json and yaml output And SwaggerModule.setup() calls serverDocuments so SwaggerCustomOptions would be the answer

Tip: Also make yaml endpoint configurable

tushar1998 avatar Aug 05 '22 17:08 tushar1998

HI @tushar1998, thanks for the answer. I also tought that SwaggerCustomOptions should be the right place, but later I saw in the documentation that these are custom options for Swagger UI, so I'm not sure if it's the place

Best regards, Jose

jcolladosp avatar Aug 05 '22 19:08 jcolladosp

I guess we can close this now.

@jcolladosp Could you please update de docs?

micalevisk avatar Feb 09 '23 19:02 micalevisk