Help us shape the future of Go! Take the 2026 Go Developer Survey

core

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alphabetical

type Alphabetical struct{}

Alphabetical checks source order. Strings use lexical order and numbers use numeric order. keyedBy selects a property from each object value.

func (Alphabetical) GetCategory added in v0.10.0

func (a Alphabetical) GetCategory() string

GetCategory returns the category of the Alphabetical rule.

func (Alphabetical) GetSchema

func (a Alphabetical) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Alphabetical rule.

func (Alphabetical) RunRule

func (a Alphabetical) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule reports unordered adjacent values. Plain maps report their first unordered pair.

type Blank

type Blank struct {
}

Blank is a pass through function that does nothing. Use this if you want a rig a rule, but don't want to check any logic, the logic is pre or post processed outside the main rule run.

func (Blank) GetCategory added in v0.10.0

func (b Blank) GetCategory() string

GetCategory returns the category of the Blank rule.

func (Blank) GetSchema

func (b Blank) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Blank rule.

func (Blank) RunRule

func (b Blank) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Blank rule, based on supplied context and a supplied []*yaml.Node slice.

type Casing

type Casing struct {
	// contains filtered or unexported fields
}

Casing is a rule that will check the value of a node to ensure it meets the required casing type.

func (Casing) GetCategory added in v0.10.0

func (c Casing) GetCategory() string

GetCategory returns the category of the Casing rule.

func (Casing) GetSchema

func (c Casing) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Casing rule.

func (Casing) RunRule

func (c Casing) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Casing rule, based on supplied context and a supplied []*yaml.Node slice.

type Defined

type Defined struct {
}

Defined is a rule that will determine if a field has been set on a node slice.

func (Defined) GetCategory added in v0.10.0

func (d Defined) GetCategory() string

GetCategory returns the category of the Defined rule.

func (Defined) GetSchema

func (d Defined) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Defined rule.

func (Defined) RunRule

func (d Defined) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Defined rule, based on supplied context and a supplied []*yaml.Node slice.

type Enumeration

type Enumeration struct{}

Enumeration is a rule that will check that a set of values meet the supplied 'values' supplied via functionOptions.

func (Enumeration) GetCategory added in v0.10.0

func (e Enumeration) GetCategory() string

GetCategory returns the category of the Enumeration rule.

func (Enumeration) GetSchema

func (e Enumeration) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Enumeration rule.

func (Enumeration) RunRule

func (e Enumeration) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Enumeration rule, based on supplied context and a supplied []*yaml.Node slice.

type Falsy

type Falsy struct {
}

Falsy is a rule that will determine if something is seen as 'false' (could be a 0 or missing, or actually 'false')

func (Falsy) GetCategory added in v0.10.0

func (f Falsy) GetCategory() string

GetCategory returns the category of the Falsy rule.

func (Falsy) GetSchema

func (f Falsy) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Falsy rule.

func (Falsy) RunRule

func (f Falsy) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Falsy rule, based on supplied context and a supplied []*yaml.Node slice. If no field is specified, the function checks if the matched node itself is truthy (and reports if so). If a field is specified, the function checks if that field within the matched node is truthy.

type Length

type Length struct{}

Length is a rule that will determine if nodes meet a 'min' or 'max' size. It checks arrays, strings and maps.

func (Length) GetCategory added in v0.10.0

func (l Length) GetCategory() string

GetCategory returns the category of the Length rule.

func (Length) GetSchema

func (l Length) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Length rule.

func (Length) RunRule

func (l Length) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Length rule, based on supplied context and a supplied []*yaml.Node slice.

type Or added in v0.33.0

type Or struct{}

Or requires at least one named property to exist on an object, regardless of its value.

func (Or) GetCategory added in v0.33.0

func (o Or) GetCategory() string

GetCategory returns the core function category.

func (Or) GetSchema added in v0.33.0

func (o Or) GetSchema() model.RuleFunctionSchema

GetSchema describes the options accepted by Or.

func (Or) RunRule added in v0.33.0

func (o Or) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule checks each object independently and reports objects with no listed property. Non-object inputs are ignored, as in Spectral.

func (Or) ValidateOptions added in v0.33.0

func (o Or) ValidateOptions(options any) error

ValidateOptions requires at least two string property names.

type Pattern

type Pattern struct{}

Pattern is a rule that will match or not match (or both) a regular expression. This struct is stateless - all state is passed through function parameters.

func (Pattern) GetCategory added in v0.10.0

func (p Pattern) GetCategory() string

GetCategory returns the category of the Pattern rule.

func (Pattern) GetSchema

func (p Pattern) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Pattern rule.

func (Pattern) RunRule

func (p Pattern) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Pattern rule, based on supplied context and a supplied []*yaml.Node slice.

type Schema

type Schema struct {
}

Schema is a rule that creates a schema check against a field value

func (Schema) GetCategory added in v0.10.0

func (sch Schema) GetCategory() string

GetCategory returns the category of the OperationParameters rule.

func (Schema) GetSchema

func (sch Schema) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the OperationParameters rule.

func (Schema) RunRule

func (sch Schema) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Schema function

func (Schema) ValidateOptions added in v0.35.4

func (sch Schema) ValidateOptions(options any) error

ValidateOptions checks the types and dialect names accepted by schema.

type Truthy

type Truthy struct {
}

Truthy is a rule that will determine if something is seen as 'true' (could be a 1 or "pizza", or actually 'true')

func (Truthy) GetCategory added in v0.10.0

func (t Truthy) GetCategory() string

GetCategory returns the category of the Truthy rule.

func (Truthy) GetSchema

func (t Truthy) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Truthy rule.

func (*Truthy) RunRule

func (t *Truthy) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Truthy rule, based on supplied context and a supplied []*yaml.Node slice. If no field is specified, the function checks if the matched node itself is falsy (and reports if so). If a field is specified, the function checks if that field within the matched node is falsy.

type Undefined

type Undefined struct {
}

Undefined is a rule that will check if a field has not been defined.

func (Undefined) GetCategory added in v0.10.0

func (u Undefined) GetCategory() string

GetCategory returns the category of the Undefined rule.

func (Undefined) GetSchema

func (u Undefined) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Undefined rule.

func (Undefined) RunRule

func (u Undefined) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Undefined rule, based on supplied context and a supplied []*yaml.Node slice.

type UnreferencedReusableObject added in v0.35.4

type UnreferencedReusableObject struct{}

UnreferencedReusableObject reports members of a reusable-object container that have no reference in the indexed document graph.

func (UnreferencedReusableObject) GetCategory added in v0.35.4

func (UnreferencedReusableObject) GetCategory() string

GetCategory returns the core function category.

func (UnreferencedReusableObject) GetSchema added in v0.35.4

GetSchema describes the required JSON Pointer to the reusable container.

func (UnreferencedReusableObject) RunRule added in v0.35.4

RunRule uses the existing reference index. It does not resolve or fetch files.

func (UnreferencedReusableObject) ValidateOptions added in v0.35.4

func (UnreferencedReusableObject) ValidateOptions(options any) error

ValidateOptions requires a local JSON Pointer, including escaped property names.

type Xor

type Xor struct {
}

Xor is a rule that will check if one property or another has been set, but not both.

func (Xor) GetCategory added in v0.10.0

func (x Xor) GetCategory() string

GetCategory returns the category of the Xor rule.

func (Xor) GetSchema

func (x Xor) GetSchema() model.RuleFunctionSchema

GetSchema returns a model.RuleFunctionSchema defining the schema of the Xor rule.

func (Xor) RunRule

func (x Xor) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult

RunRule will execute the Xor rule, based on supplied context and a supplied []*yaml.Node slice.

Jump to

Keyboard shortcuts

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