motor

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const CircularReferencesFix string = "Circular references are created by schemas that reference back to themselves somewhere " +
	"in the chain. The link could be very deep, or it could be super shallow. Sometimes it's hard to know what is looping " +
	"without resolving the references. This model is looping, Remove the looping link in the chain."

todo: move copy into virtual file system or some kind of map.

Variables

This section is empty.

Functions

func ApplyRules deprecated

func ApplyRules(ruleSet *rulesets.RuleSet, spec []byte) ([]model.RuleFunctionResult, error)

Deprecated: ApplyRules will apply a loaded model.RuleSet against an OpenAPI specification. Please use ApplyRulesToRuleSet instead of this function, the signature needs to change.

Types

type RuleComposer

type RuleComposer struct {
}

RuleComposer will consume a ruleset specification into a *model.RuleSet

func CreateRuleComposer

func CreateRuleComposer() *RuleComposer

CreateRuleComposer will create a new RuleComposer and return a pointer to it.

func (*RuleComposer) ComposeRuleSet

func (rc *RuleComposer) ComposeRuleSet(ruleset []byte) (*rulesets.RuleSet, error)

ComposeRuleSet compose a byte array ruleset specification into a *model.RuleSet

type RuleSetExecution

type RuleSetExecution struct {
	RuleSet *rulesets.RuleSet
	Spec    []byte
}

RuleSetExecution is an instruction set for executing a ruleset. It's a convenience structure to allow the signature of ApplyRules to change, without a huge refactor. The ApplyRules function only returns a single error also.

type RuleSetExecutionResult

type RuleSetExecutionResult struct {
	RuleSetExecution *RuleSetExecution
	Results          []model.RuleFunctionResult
	Index            *model.SpecIndex
	SpecInfo         *model.SpecInfo
	Errors           []error
}

RuleSetExecutionResult returns the results of running the ruleset against the supplied spec.

func ApplyRulesToRuleSet

func ApplyRulesToRuleSet(execution *RuleSetExecution) *RuleSetExecutionResult

ApplyRulesToRuleSet is a replacement for ApplyRules. This function was created before trying to use vacuum as an API. The signature is not sufficient, but is embedded everywhere. This new method uses a message structure, to allow the signature to grow, without breaking anything.

Jump to

Keyboard shortcuts

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