lintutil

package
v1.18.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RulenameDatatypeIntFormatStandardExist = "datatype-int-format-standard-exist"
	RuleOpDescExist                        = "operation-description-exist"
	RuleOpIdExist                          = "operation-operationid-exist"

	RulenameOpIdStyleCamelCase  = "operation-operationid-style-camelcase"
	RulenameOpIdStyleKebabCase  = "operation-operationid-style-kebabcase"
	RulenameOpIdStylePascalCase = "operation-operationid-style-pascalcase"
	RulenameOpIdStyleSnakeCase  = "operation-operationid-style-snakecase"

	RulenameSchemaNameStylePascalCase = "schema-name-style-pascalcase"
	RulenameSchemaHasReference        = "schema-has-reference"
	RulenameSchemaReferenceHasSchema  = "schema-reference-has-schema"

	RulenameOpSummaryExist               = "operation-summary-exist"
	RulenameOpSummaryStyleFirstUpperCase = "operation-summary-style-first-uppercase"

	RuleOpTagsCountOneOnly = "operation-tags-count-one"
	RulePathParamNameExist = "path-param-name-exist"

	RulenamePathParamStyleCamelCase  = "path-param-style-camelcase"
	RulenamePathParamStyleKebabCase  = "path-param-style-kebabcase"
	RulenamePathParamStylePascalCase = "path-param-style-pascalcase"
	RulenamePathParamStyleSnakeCase  = "path-param-style-snakecase"

	RulenameSchemaPropEnumStyleCamelCase  = "schema-property-enum-style-camelcase"
	RulenameSchemaPropEnumStyleKebabCase  = "schema-property-enum-style-kebabcase"
	RulenameSchemaPropEnumStylePascalCase = "schema-property-enum-style-pascalcase"
	RulenameSchemaPropEnumStyleSnakeCase  = "schema-property-enum-style-snakecase"

	RuleSchemaPropDescExist = "property-description-exist"

	RulenameSchemaObjectPropsExist = "schema-object-properties-exist"

	RulenameTagStyleFirstUpperCase = "tag-style-first-uppercase"
)
View Source
const (
	ScopeOperation     = "operation"
	ScopeSpecification = "specification"
)

Variables

This section is empty.

Functions

func ParseScope

func ParseScope(s string) (string, error)

func ScopeMatch

func ScopeMatch(wantScope, tryScope string) bool

Types

type PolicyRule

type PolicyRule struct {
	Name         string
	StringFormat string
}

type PolicyViolation

type PolicyViolation struct {
	RuleName  string
	RuleType  string
	Violation string
	Value     string
	Location  string
	Data      map[string]string
}

type PolicyViolationLocations

type PolicyViolationLocations struct {
	RuleName  string
	Locations []string
}

func (*PolicyViolationLocations) Finalize

func (vl *PolicyViolationLocations) Finalize()

type PolicyViolationsSet

type PolicyViolationsSet struct {
	RuleName   string
	Violations []PolicyViolation
}

func NewPolicyViolationsSet

func NewPolicyViolationsSet(ruleName string) PolicyViolationsSet

func (*PolicyViolationsSet) Count

func (set *PolicyViolationsSet) Count() uint

func (*PolicyViolationsSet) Locations

type PolicyViolationsSets

type PolicyViolationsSets struct {
	ByRule map[string]PolicyViolationsSet
}

PolicyViolationsSets is a container for `openapi3lint` policy violations. Common approaches to view violatiosn are to use `PolicyViolationsSets.LocationsByRule()` and `PolicyViolationsSets.CountsByRule()`.

func NewPolicyViolationsSets

func NewPolicyViolationsSets() *PolicyViolationsSets

func (*PolicyViolationsSets) AddSimple

func (sets *PolicyViolationsSets) AddSimple(ruleName, location, value string)

func (*PolicyViolationsSets) AddViolation

func (sets *PolicyViolationsSets) AddViolation(violation PolicyViolation)

func (*PolicyViolationsSets) AddViolations

func (sets *PolicyViolationsSets) AddViolations(violations []PolicyViolation)

func (*PolicyViolationsSets) Count

func (sets *PolicyViolationsSets) Count() uint

func (*PolicyViolationsSets) CountsByRule added in v1.8.0

func (sets *PolicyViolationsSets) CountsByRule() map[string]uint

func (*PolicyViolationsSets) LocationsByRule

func (sets *PolicyViolationsSets) LocationsByRule() ViolationLocationsByRuleSet

func (*PolicyViolationsSets) UpsertSet

func (sets *PolicyViolationsSets) UpsertSet(upsertSet PolicyViolationsSet) error

func (*PolicyViolationsSets) UpsertSets

func (sets *PolicyViolationsSets) UpsertSets(upsertSets *PolicyViolationsSets) error

type ViolationLocationsByRuleSet

type ViolationLocationsByRuleSet struct {
	ViolationLocationsByRule map[string][]string
}

func (*ViolationLocationsByRuleSet) Condense

func (vlrs *ViolationLocationsByRuleSet) Condense()

func (*ViolationLocationsByRuleSet) Count

func (vlrs *ViolationLocationsByRuleSet) Count() uint

Jump to

Keyboard shortcuts

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