github.com/go-swagger/go-swagger@v0.31.0/docs/reference/annotations/response.md (about) 1 --- 2 title: response 3 date: 2023-01-01T01:01:01-08:00 4 draft: true 5 --- 6 # swagger:response 7 8 Reads a struct decorated with **swagger:response** and uses that information to fill up the headers and the schema for a response. 9 A swagger:route can specify a response name for a status code and then the matching response will be used for that operation in the swagger definition. 10 11 <!--more--> 12 13 ##### Syntax: 14 15 ```go 16 swagger:response [?response name] 17 ``` 18 19 ##### Properties 20 21 Annotation | Description 22 **Items.*n*.Maximum** | specifies the maximum a number or integer value can have at the level *n* 23 **Items.*n*.Minimum** | specifies the minimum a number or integer value can have at the level *n* 24 **Items.*n*.Multiple of** | specifies a value a number or integer value must be a multiple of 25 **Items.*n*.Minimum length** | the minimum length for a string value at the level *n* 26 **Items.*n*.Maximum length** | the maximum length for a string value at the level *n* 27 **Items.*n*.Pattern** | a regular expression a string value needs to match at the level *n* 28 **Items.*n*.Minimum items** | the minimum number of items a slice needs to have at the level *n* 29 **Items.*n*.Maximum items** | the maximum number of items a slice can have at the level *n* 30 **Items.*n*.Unique** | when set to true the slice can only contain unique items at the level *n* 31 32 ##### Example 33 34 ```go 35 // A ValidationError is an error that is used when the required input fails validation. 36 // swagger:response validationError 37 type ValidationError struct { 38 // The error message 39 // in: body 40 Body struct { 41 // The validation message 42 // 43 // Required: true 44 // Example: Expected type int 45 Message string 46 // An optional field name to which this validation applies 47 FieldName string 48 } 49 } 50 ``` 51 52 ##### Result 53 54 ```yaml 55 ```