Documentation
¶
Overview ¶
Package bind decides which parameters get their value from an earlier response (FR-PARAM-01 rank 1, FR-PARAM-03/05/06) and extracts those values.
Sources, in order of precedence:
- x-apitest-bind at the parameter,
- OpenAPI links in a 2xx response of the producing operation,
- a heuristic for path parameters within the same resource group.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Extract ¶
Extract reads the value of src from an exchange. body is the decoded response body (nil if none), reqBody the decoded request body.
func LastSegment ¶
LastSegment returns the last path segment of a URL or path, e.g. "42" for "/books/42" or "http://h/books/42?x=1".
Types ¶
type Binding ¶
type Binding struct {
Consumer *spec.Operation
Param *openapi3.Parameter
Producer *spec.Operation
Source Source
Kind Kind
}
Binding fills one parameter of a consumer operation from a producer.
func (*Binding) CrossGroup ¶
CrossGroup reports whether producer and consumer are in different groups.
type Set ¶
Set holds all bindings of a spec.
func Resolve ¶
Resolve determines the bindings of all operations. Errors in explicit declarations are returned before any request is sent (NFR-08).
type Source ¶
type Source struct {
// Pointer is a JSON pointer into the response body (or the request body
// if FromRequest is set), e.g. "/id".
Pointer string
// Header is a response header. For "Location" the last path segment is
// used (FR-PARAM-03).
Header string
FromRequest bool
// Const is a constant value from a link.
Const any
HasConst bool
}
Source is where a bound value comes from.