Using go-swagger, how to have the @description reference an external Markdown file?

268 Views Asked by At

So I am using the above two technologies to autogenerate my swagger.yaml file that then is read by Redoc and served to the clients. This is the step in my makefile:

swag init -g internal/delivery/rest/router.go --output swagger/ --outputTypes yaml

Then in my Redoc I simply reference swagger.yaml and everything works like charm.

But I have one problem. In my @description annotation for the API I have something like this:

   // @description "This is a description!"

But I want that this description actually come from a Markdown file. I know that if I manually add:

   description:
     $ref: 'description.md'

to my swagger.yaml file it works perfectly. But the thing is I can only hardcode the string in the annotations. I tried this in my annotation:

// @description file://description.md

But it literally generates this in my YAML file:

description: 'file://description.md'

How can I achieve what I want?

0

There are 0 best solutions below