Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( QueryTag = tagDescription{ // contains filtered or unexported fields } QsTag = QueryTag HeaderTag = tagDescription{ // contains filtered or unexported fields } JSONTag = tagDescription{ // contains filtered or unexported fields } CookieTag = tagDescription{ // contains filtered or unexported fields } )
Functions ¶
func IgnoreField ¶
func IgnoreField(field schema.StructField) bool
IgnoreField returns true if the field name is "-" is any of the valid request or response tags
Types ¶
type APIEncoding ¶
type APIEncoding struct { DefaultMethod string `json:"default_method"` // Expresses how the default request encoding and method should be // Note: DefaultRequestEncoding.HTTPMethods will always be a slice with length 1 DefaultRequestEncoding *RequestEncoding `json:"request_encoding"` // Expresses all the different ways the request can be encoded for this RPC RequestEncoding []*RequestEncoding `json:"all_request_encodings"` // Expresses how the response to this RPC will be encoded ResponseEncoding *ResponseEncoding `json:"response_encoding"` }
APIEncoding expresses how an RPC should be encoded on the wire for both the request and responses.
func (*APIEncoding) RequestEncodingForMethod ¶
func (e *APIEncoding) RequestEncodingForMethod(method string) *RequestEncoding
RequestEncodingForMethod returns the request encoding required for the given HTTP method. If the method is not supported by the RPC it reports nil.
type AuthEncoding ¶
type AuthEncoding struct { // LegacyTokenFormat specifies whether the auth encoding uses the legacy format of // "just give us a token as a string". If true, the other parameters are all empty. LegacyTokenFormat bool // Contains metadata about how to marshal an HTTP parameter HeaderParameters []*ParameterEncoding `json:"header_parameters"` QueryParameters []*ParameterEncoding `json:"query_parameters"` CookieParameters []*ParameterEncoding `json:"cookie_parameters"` }
AuthEncoding expresses how a response should be encoded on the wire.
func DescribeAuth ¶
func DescribeAuth(errs *perr.List, authSchema schema.Type) *AuthEncoding
DescribeAuth generates a ParameterEncoding per field of the auth struct and returns it as the AuthEncoding. If authSchema is nil it returns nil.
type ParameterEncoding ¶
type ParameterEncoding struct { // SrcName is the name of the struct field SrcName string `json:"src_name"` // WireName is how the name is encoded on the wire. WireName string `json:"wire_name"` // Location is the location this encoding is for. Location WireLoc `json:"location"` // OmitEmpty specifies whether the parameter should be omitted if it's empty. OmitEmpty bool `json:"omit_empty"` // Doc is the documentation of the struct field Doc string `json:"doc"` // Type is the field's type description. Type schema.Type `json:"type"` }
ParameterEncoding expresses how a parameter should be encoded on the wire
type RequestEncoding ¶
type RequestEncoding struct { // The HTTP methods this encoding can be used for HTTPMethods []string `json:"http_methods"` // Contains metadata about how to marshal an HTTP parameter HeaderParameters []*ParameterEncoding `json:"header_parameters"` QueryParameters []*ParameterEncoding `json:"query_parameters"` BodyParameters []*ParameterEncoding `json:"body_parameters"` }
RequestEncoding expresses how a request should be encoded for an explicit set of HTTPMethods
func DescribeRequest ¶
func DescribeRequest(errs *perr.List, requestSchema schema.Type, httpMethods ...string) []*RequestEncoding
DescribeRequest groups the provided httpMethods by default WireLoc and returns a RequestEncoding per WireLoc
type ResponseEncoding ¶
type ResponseEncoding struct { // Contains metadata about how to marshal an HTTP parameter HeaderParameters []*ParameterEncoding `json:"header_parameters"` BodyParameters []*ParameterEncoding `json:"body_parameters"` }
ResponseEncoding expresses how a response should be encoded on the wire
func DescribeResponse ¶
func DescribeResponse(errs *perr.List, responseSchema schema.Type) *ResponseEncoding
DescribeResponse generates a ParameterEncoding per field of the response struct and returns it as the ResponseEncoding
type WireLoc ¶
type WireLoc string
WireLoc is the location of a parameter in the HTTP request/response.
const ( Undefined WireLoc = "undefined" // Parameter location is undefined Header WireLoc = "header" // Parameter is placed in the HTTP header Query WireLoc = "query" // Parameter is placed in the query string Body WireLoc = "body" // Parameter is placed in the body Cookie WireLoc = "cookie" // Parameter is placed in cookies )