Titles & descriptions

The same Go doc comments feed both pkg.go.dev and your API documentation, and the two audiences rarely want the exact same words. These knobs let you keep a concise godoc while curating the title / description text the spec carries.

  • Replace the godoc-derived title and description with API-facing text using swagger:title and swagger:description — on models, fields, $ref’d fields and responses.
  • Carry a verbatim markdown body — tables, blank lines, indentation and all — into a description with the swagger:description | literal block-scalar marker, instead of letting Option B fold it.
  • Let swagger annotations live inside a struct body or as trailing comments so the godoc above each declaration stays clean — the AfterDeclComments opt-in.
  • Strip godoc doc-link brackets from generated descriptions and recompose resolvable links to each schema’s exposed name — the CleanGoDoc opt-in.