0

I am currently using fastify (3.20.1) and fastify-swagger(4.8.4). The situation is: I can add all the REST API verbs (PUT, PATCH, DELETE etc.) in my route specification in JavaScript Node Js.

Now I want to add a customized stuff like "Doc" in every section. Something like in the below:

   MySection
   Doc
   GET
   POST

I can see the fastify documentation that it supports, quite logically, the typical REST API verbs.

My question is: how can I support another 'custom verb' (like doc).

One way, naively, I can think of: to download swagger ui and add some customization there. But then how can I may register my swagger-ui to fastify.

Please suggest what is the best way to go forward.

Thanks, Pradip

Pradip
  • 509
  • 1
  • 5
  • 22
  • Apology to call out what I tried out: I checked the swagger-fastify doc. Which has a uiConfig section. But it seems taking only a few options. So if I can someway register my own customized swagger-ui, I can proceed. How can I do it? – Pradip Sep 23 '21 at 05:30
  • Can you add these docs to the [`info.description`](https://spec.openapis.org/oas/v3.0.3.html#info-object) section of your API definition instead, or to operation-level `description`? That's what `description` fields are for. – Helen Sep 23 '21 at 07:04
  • Yes sir. That is what exactly I am doing. Writing html in a string and append the string to description. But requirement is asking for a doc route sort of. Hence looking out here for solution. – Pradip Sep 23 '21 at 09:24
  • The way I am thinking is: I will download the swagger-ui and will add a tag there (say api-doc). Now I have two issues: # How can I point the fastify/fastify-swagger to pick up the my_modified_swagger_ui/dist folder # How can I add this api-doc as a method in swagger such that I can specify in route specification as fastify.route({method: api-doc, url: .....}). – Pradip Sep 23 '21 at 11:05

0 Answers0