Annotation index
The complete swagger:* vocabulary, one row each. By example jumps to the
tutorial that shows the annotation as runnable Go next to the spec it produces;
Reference jumps to the exhaustive rule in the Maintainers compendium.
| Annotation | Attaches to | Produces | By example | Reference |
|---|---|---|---|---|
swagger:meta | package doc | top-level info, host, basePath, schemes, … | example | reference |
swagger:model | type declaration | a definitions entry | example | reference |
swagger:strfmt | type declaration | {type: string, format: …} at every use | example | reference |
swagger:enum | named type | an enum array (+ x-go-enum-desc) | example | reference |
swagger:allOf | embedded field / struct | an allOf composition | example | reference |
swagger:alias | type alias | a $ref to the target (vs inline expansion) | how-to | reference |
swagger:route | func / var doc | a paths entry + operation | example | reference |
swagger:operation | func / var doc | a paths entry (YAML body) | example | reference |
swagger:parameters | struct declaration | parameters on the named operation(s) | example | reference |
swagger:response | struct declaration | a responses entry | example | reference |
swagger:ignore | type / field doc | excludes the declaration | example | reference |
swagger:name | field / method doc | renames a JSON property | example | reference |
swagger:type | type / field doc | overrides the inferred Swagger type | example | reference |
swagger:file | param / response field | {type: file} | example | reference |
swagger:default | value / field doc | a default-value anchor | example | reference |
Keywords, not annotations
Validations, examples and defaults inside a block are driven by keywords
(minimum:, pattern:, enum:, example:, default:, …), not annotations.
See the Validations and
Examples & defaults
tutorials, and the Keyword reference.