schema

package
v1.261001.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointCount added in v1.260519.0

func EndpointCount() (int, error)

EndpointCount returns the number of endpoints in the embedded schema index.

func SchemaCommand

func SchemaCommand() *ffcli.Command

SchemaCommand returns the schema command.

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

func MatchOperation(method, path string) (Endpoint, bool, error)

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

func NearestOperations(method, path string, limit int) ([]Endpoint, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL