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:additionalProperties | type doc | object additionalProperties (open / closed / typed) | example | reference |
swagger:alias (deprecated) | type alias | no effect — alias rendering is controlled by Go aliases + options | how-to | reference |
swagger:allOf | embedded field / struct | an allOf composition | example | reference |
swagger:default | value / field doc | a default-value anchor | example | reference |
swagger:description | type / field / response doc | overrides the description (verbatim body with |) | how-to | reference |
swagger:enum | named type | an enum array (+ x-go-enum-desc) | example | reference |
swagger:file | param / response field | {type: file} | example | reference |
swagger:ignore | type / field doc | excludes the declaration | example | reference |
swagger:meta | package doc | top-level info, host, basePath, schemes, … | example | reference |
swagger:model | type declaration | a definitions entry | example | reference |
swagger:name | field / method doc | renames a JSON property | example | reference |
swagger:omit | embed / type doc | drops named fields from what an embed promotes | how-to | 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:patternProperties | type doc | typed patternProperties (regex → value) | example | reference |
swagger:response | struct declaration | a responses entry | example | reference |
swagger:route | func / var doc | a paths entry + operation | example | reference |
swagger:strfmt | type declaration | {type: string, format: …} at every use | example | reference |
swagger:title | type / field doc | overrides the title | how-to | reference |
swagger:type | type / field doc | overrides the inferred Swagger type | 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.