Documentation ¶
Index ¶
- Constants
- Variables
- func RulesConfigExample1() map[string]RuleConfig
- func ValidateRules(policyRules map[string]PolicyRule) error
- type EmptyRule
- func (rule EmptyRule) Name() string
- func (rule EmptyRule) ProcessOperation(spec *openapi3.Spec, op *oas3.Operation, opPointer, path, method string) []lintutil.PolicyViolation
- func (rule EmptyRule) ProcessSpec(spec *openapi3.Spec, pointerBase string) []lintutil.PolicyViolation
- func (rule EmptyRule) Scope() string
- type Policy
- func (pol *Policy) AddRule(rule Rule, sev string, errorOnCollision bool) error
- func (pol *Policy) RuleNames() []string
- func (pol *Policy) ValidateSpec(spec *openapi3.Spec, pointerBase, filterSeverity string) (*lintutil.PolicyViolationsSets, error)
- func (pol *Policy) ValidateSpecFiles(filterSeverity string, specfiles []string) (*lintutil.PolicyViolationsSets, error)
- type PolicyConfig
- type PolicyRule
- type Rule
- type RuleCollection
- type RuleCollectionSimple
- func (simple RuleCollectionSimple) AddRule(rule Rule) error
- func (simple RuleCollectionSimple) Name() string
- func (simple RuleCollectionSimple) Rule(ruleName string) (Rule, error)
- func (simple RuleCollectionSimple) RuleExists(ruleName string) bool
- func (simple RuleCollectionSimple) RuleNames() []string
- type RuleCollectionStandard
- type RuleCollections
- type RuleConfig
- type RulesMap
Constants ¶
View Source
const ( RuleTypeAll = "all" RuleTypeStandard = "standard" RuleTypeXDefined = "xdefined" RuleTypeXUndefined = "xundefined" )
Variables ¶
View Source
var ErrNoSpecFiles = errors.New("no spec files supplied")
Functions ¶
func RulesConfigExample1 ¶ added in v1.7.0
func RulesConfigExample1() map[string]RuleConfig
func ValidateRules ¶
func ValidateRules(policyRules map[string]PolicyRule) error
Types ¶
type EmptyRule ¶ added in v1.7.0
type EmptyRule struct{}
func (EmptyRule) ProcessOperation ¶ added in v1.7.0
func (EmptyRule) ProcessSpec ¶ added in v1.7.0
type Policy ¶
type Policy struct {
// contains filtered or unexported fields
}
func NewPolicyWithConfig ¶ added in v1.14.0
NewPolicyWithConfig is useful when not programatically augmenting the `PolicyConfig` struct before creating the `Policy` struct. For example, `PolicyConfig.AddRuleCollection()` can be called programmtcally. before calling `PolicyConfig.Policy()`.
func (*Policy) ValidateSpec ¶
func (*Policy) ValidateSpecFiles ¶ added in v1.14.0
func (pol *Policy) ValidateSpecFiles(filterSeverity string, specfiles []string) (*lintutil.PolicyViolationsSets, error)
ValidateSpecFiles executes the policy against a set of one or more spec files. `sev` is the severity as specified by `github.com/grokify/mogo/log/severity`. A benefit of using this over `ValidateSpec()` when validating multiple files is that this will automatically inject the filename as a JSON pointer base.`
type PolicyConfig ¶
type PolicyConfig struct { Name string `json:"name"` Version string `json:"version"` LastUpdated time.Time `json:"lastUpdated,omitempty"` IncludeStandardRules bool `json:"includeStandardRules"` Rules map[string]RuleConfig `json:"rules,omitempty"` NonStandardRules []string `json:"nonStandardRules,omitempty"` // contains filtered or unexported fields }
func NewPolicyConfigFile ¶
func NewPolicyConfigFile(filename string) (PolicyConfig, error)
func (*PolicyConfig) AddRuleCollection ¶ added in v1.7.3
func (polCfg *PolicyConfig) AddRuleCollection(collection RuleCollection)
func (*PolicyConfig) Policy ¶ added in v1.7.3
func (polCfg *PolicyConfig) Policy() (Policy, error)
func (*PolicyConfig) RuleNames ¶ added in v1.7.1
func (polCfg *PolicyConfig) RuleNames() map[string][]string
type PolicyRule ¶ added in v1.8.0
type RuleCollection ¶ added in v1.7.3
type RuleCollectionSimple ¶ added in v1.8.0
type RuleCollectionSimple struct {
// contains filtered or unexported fields
}
func (RuleCollectionSimple) AddRule ¶ added in v1.8.0
func (simple RuleCollectionSimple) AddRule(rule Rule) error
func (RuleCollectionSimple) Name ¶ added in v1.8.0
func (simple RuleCollectionSimple) Name() string
func (RuleCollectionSimple) Rule ¶ added in v1.8.0
func (simple RuleCollectionSimple) Rule(ruleName string) (Rule, error)
func (RuleCollectionSimple) RuleExists ¶ added in v1.8.0
func (simple RuleCollectionSimple) RuleExists(ruleName string) bool
func (RuleCollectionSimple) RuleNames ¶ added in v1.8.0
func (simple RuleCollectionSimple) RuleNames() []string
type RuleCollectionStandard ¶ added in v1.7.3
type RuleCollectionStandard struct {
// contains filtered or unexported fields
}
func NewRuleCollectionStandard ¶ added in v1.7.3
func NewRuleCollectionStandard() RuleCollectionStandard
func (RuleCollectionStandard) Name ¶ added in v1.7.3
func (std RuleCollectionStandard) Name() string
func (RuleCollectionStandard) Rule ¶ added in v1.7.3
func (std RuleCollectionStandard) Rule(name string) (Rule, error)
func (RuleCollectionStandard) RuleExists ¶ added in v1.7.3
func (std RuleCollectionStandard) RuleExists(ruleName string) bool
func (RuleCollectionStandard) RuleNames ¶ added in v1.7.3
func (std RuleCollectionStandard) RuleNames() []string
type RuleCollections ¶ added in v1.7.3
type RuleCollections []RuleCollection
type RuleConfig ¶
type RuleConfig struct {
Severity string `json:"severity"`
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
ruleschemaobjectpropsexist ensures that schema objects have properties.
|
ruleschemaobjectpropsexist ensures that schema objects have properties. |
Click to show internal directories.
Click to hide internal directories.