Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndpointCount ¶ added in v1.260519.0
EndpointCount returns the number of endpoints in the embedded schema index.
Types ¶
type Endpoint ¶
type Endpoint struct {
Method string `json:"method"`
Path string `json:"path"`
Parameters []Parameter `json:"parameters,omitempty"`
RequestSchema string `json:"requestSchema,omitempty"`
RequestAttributes map[string]any `json:"requestAttributes,omitempty"`
RequestRelationships map[string]RequestRelationship `json:"requestRelationships,omitempty"`
ResponseSchema string `json:"responseSchema,omitempty"`
// contains filtered or unexported fields
}
Endpoint is a compact representation of an API endpoint.
func MatchOperation ¶
MatchOperation reports the indexed endpoint whose method and templated path match a concrete request path. Template segments such as {id} match any single non-empty path segment. The path may carry a query string, which is ignored, and a trailing slash.
func NearestOperations ¶
NearestOperations ranks indexed endpoints by how closely they resemble the requested method and path and returns up to limit of them. Endpoints whose template matches the whole path under a different method rank first, then endpoints sharing the longest leading segment run. Ties prefer the requested method, then the smallest edit distance between the first differing segments, then the smallest length difference.
type Parameter ¶
type Parameter struct {
Name string `json:"name"`
In string `json:"in"`
Enum []string `json:"enum,omitempty"`
Required bool `json:"required,omitempty"`
}
Parameter describes a query/path parameter.
type RequestRelationship ¶ added in v1.260722.0
type RequestRelationship struct {
ResourceType string `json:"resourceType"`
Cardinality string `json:"cardinality"`
Required bool `json:"required"`
}
RequestRelationship describes a JSON:API relationship accepted by a request.