Documentation ¶
Index ¶
Constants ¶
View Source
const ( DocTag = "doc" DefaultTag = "default" MinTag = "min" MaxTag = "max" MaxLenTag = "maxlen" MinLenTag = "minlen" HiddenTag = "hidden" RequiredTag = "required" AllowEmptyTag = "allowEmpty" PatternTag = "pattern" InTag = "in" GlobalTag = "global" )
Struct field definitions
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ParamInfo ¶
type ParamInfo struct { // the struct name of the param StructKey string // The request name of the parameter, case sensitive Name string // Documentation description Description string // Is this param required or optional Required bool // The param's reflect.Kind. We allow string,int,float,bool,slice. // We allow struct only for unmarshalers (see Unmarshaler) Kind reflect.Kind // the param's native type Type reflect.Type // extra format info for swagger compliance. see https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md#431-primitives Format string // Default value, parsed from string based on the param type Default interface{} // The unparsed, raw value of the default RawDefault string // did we have a default value? the default may legitimately be nil or empty or 0 HasDefault bool // Max for numbers Max float64 // Did we have a max definition HasMax bool // Min for numbers Min float64 //did we have a min definition? HasMin bool // Maxlength for strings. irrelevant if 0 MaxLength int // Minlength for strings. irrelevant if 0 MinLength int // Regex pattern match. TODO: add to the validator logic Pattern string // One-of string selection Options []string // Where is the param in. empty is query/body. should be set only to "path" in case of path params In string Hidden bool // Is this param a reference to a global definition? If so, we copy its definition to the parameters type // of the generated swagger Global bool }
ParamInfo represents metadata about a requests parameter
type RequestInfo ¶
type RequestInfo struct { Path string Description string Group string Returns interface{} Params []ParamInfo }
RequestInfo represents a single request's descriptor
func NewRequestInfo ¶
func NewRequestInfo(T reflect.Type, pth string, description string, returnValue interface{}) (RequestInfo, error)
NewRequestInfo Builds a requestInfo from a requestHandler struct using reflection
func (RequestInfo) ToSwagger ¶
func (r RequestInfo) ToSwagger() swagger.Method
Click to show internal directories.
Click to hide internal directories.