Documentation ¶
Index ¶
Constants ¶
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. This can also appear with missing or " +
"references that cannot be located or resolved correctly."
todo: move copy into virtual file system or some kind of map.
Variables ¶
This section is empty.
Functions ¶
func BuildRolodexFromIndexConfig ¶ added in v0.4.0
func BuildRolodexFromIndexConfig(indexConfig *index.SpecIndexConfig) (*index.Rolodex, error)
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 // The RuleSet in which to apply SpecFileName string // The name of the specification file, used to correctly label location Spec []byte // The raw bytes of the OpenAPI specification. SpecInfo *datamodel.SpecInfo // Pre-parsed spec-info. CustomFunctions map[string]model.RuleFunction // custom functions loaded from plugin. PanicFunction func(p any) // In case of emergency, do this thing here. SilenceLogs bool // Prevent any warnings about rules/rule-sets being printed. Base string // The base path or URL of the specification, used for resolving relative or remote paths. AllowLookup bool // Allow remote lookup of files or links Document libopenapi.Document // a ready to render model. DrDocument *doctor.DrDocument // a high level, more powerful model, powered by the doctor. SkipDocumentCheck bool // Skip the document check, useful for fragments and non openapi specs. Logger *slog.Logger // A custom logger. Timeout time.Duration // The timeout for each rule to run, prevents run-away rules, default is five seconds. // https://pb33f.io/libopenapi/circular-references/#circular-reference-results IgnoreCircularArrayRef bool // Ignore array circular references IgnoreCircularPolymorphicRef bool // Ignore polymorphic circular references }
RuleSetExecution is an instruction set for executing a ruleset. It's a convenience structure to allow the signature of ApplyRulesToRuleSet to change, without a huge refactor. The ApplyRulesToRuleSet function only returns a single error also.
type RuleSetExecutionResult ¶
type RuleSetExecutionResult struct { RuleSetExecution *RuleSetExecution // The execution struct that was used invoking the result. Results []model.RuleFunctionResult // The results of the execution. Index *index.SpecIndex // The index that was created from the specification, used by the rules. SpecInfo *datamodel.SpecInfo // A reference to the SpecInfo object, used by all the rules. Errors []error // Any errors that were returned. FilesProcessed int // number of files extracted by the rolodex FileSize int64 // total filesize loaded by the rolodex }
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.