response

swagger:response #

Reads a struct decorated with swagger:response and uses that information to fill up the headers and the schema for a response. 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.

Syntax: #
swagger:response [?response name]
Properties #

Annotation | Description Items.n.Maximum | specifies the maximum a number or integer value can have at the level n Items.n.Minimum | specifies the minimum a number or integer value can have at the level n Items.n.Multiple of | specifies a value a number or integer value must be a multiple of Items.n.Minimum length | the minimum length for a string value at the level n Items.n.Maximum length | the maximum length for a string value at the level n Items.n.Pattern | a regular expression a string value needs to match at the level n Items.n.Minimum items | the minimum number of items a slice needs to have at the level n Items.n.Maximum items | the maximum number of items a slice can have at the level n Items.n.Unique | when set to true the slice can only contain unique items at the level n

Example #
// A ValidationError is an error that is used when the required input fails validation.
// swagger:response validationError
type ValidationError struct {
	// The error message
	// in: body
	Body struct {
		// The validation message
		//
		// Required: true
		// Example: Expected type int
		Message string
		// An optional field name to which this validation applies
		FieldName string
	}
}
Result #

Copyright 2015-2024 the go-swagger maintainers. This documentation is under an Apache 2.0 license.

Site built with HUGO using hugo-book