Documentation
¶
Overview ¶
Package params resolves parameter values (FR-PARAM-01/02) and serializes them according to the OpenAPI style rules (FR-PARAM-07).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeQuery ¶
EncodeQuery builds a query string from pairs, keeping their order.
func Generated ¶
Generated is a plain value that fits schema s, for a parameter nothing else gives a value: its default or first enum value, else by type and format within the limits of the schema. ok is false if none fits (e.g. a pattern the value does not match).
Types ¶
type Inputs ¶
type Inputs struct {
CaseName string // example name of the case, e.g. "valid-planet"
Fixed map[string]string // Config.Params
OpID string // operation of the case, for "<operationId>.<name>" keys
// Binding returns a bound value for a parameter, if any (rank 1).
Binding func(p *openapi3.Parameter) (any, bool)
// Override sets path parameters by name before any other source: the
// unknown key of a not-found case.
Override map[string]any
// Generate gives a required parameter no source has a value for one
// derived from its schema (Generated), e.g. the parent key of a
// not-found case whose producer did not run.
Generate bool
}
Inputs are the sources that depend on the run rather than on the spec.
type Pair ¶
type Pair struct {
Key, Value string
}
Pair is one serialized query parameter or cookie.
type Rank ¶
type Rank int
Rank is the source of a parameter value, in order of precedence.
const ( RankNone Rank = iota RankBinding // 1: value from an earlier response RankFixed // 2: Config.Params RankNamedExample // 3: named example with the case's name RankExample // 4: example of the parameter RankSchemaExample // 5: example/examples[0] of the schema RankDefault // 6: default of the schema RankEnum // 7: first enum value RankGenerated // 8: generated from the schema (Inputs.Generate) )
Ranks in order of precedence (see "How it works" in the README).