I am using Servant.OpenApi.toOpenApi to generate an OpenApi (i.e, “Swagger”) description. In the example that follows, the api variable holds the generated description.
I have figured out how to use operationsOf to add a description to a route of the generated OpenApi description via:
I don’t see any numMsgs in the example you’ve given, but it should be as easy as doing the following in the path definition:
type GetUser =
"user" :>
QueryParam' [Optional, Strict, ParamDescription] "id" UserId :>
Get '[JSON] User
type ParamDescription =
Description "Put here whatever you want about the query parameter"
Same with Header' '[Description "..."], Capture' '[Description "..."], etc.
See THIS for some examples of how to give the path in its entirety a description.
Basically, just put the Description "..." in the :> ... :> definition of your path.