'When to use swagger route vs swagger operator

I am trying to auto-generate swagger.yaml file using go-swagger in my golang project. I understood difference between path and operation. And here are links for individual documentation for swagger:router and swagger:operator. As I see the syntax for both looks same and I don't understand the nuance between them and when one should be used over another and in what cases ?



Solution 1:[1]

swagger:route is a bespoke syntax that has nothing to do with yaml, you'll notice this especially when you are defining responses

swagger:operation serves the same purpose in that it also allows you to define and describe routes, but the way you define parameters and responses is the regular swagger spec yaml. So with swagger:operation you are basically defining yaml snippets that get put verbatim in the swagger spec file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Casual Jim