linter

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_linter_proto protoreflect.FileDescriptor

Functions

func LintOpenAPIValidator added in v0.5.2

func LintOpenAPIValidator(filename string)

LintOpenapiValidator functions serves as a linter results translater. The function takes the filename which contains the json results of IBM's openapi-validator and creates a new instance of the linter struct using the JSON data.

func LintSpectral

func LintSpectral(filename string)

LintSpectral functions serves as a linter results translater. The function takes the filename which contains the text results of Stoplights's spectral and creates a new instance of the linter struct using the text data.

Types

type EMessage

type EMessage struct {
	Path    []string `json:"path"`
	Message string   `json:"message"`
	Line    int      `json:"line"`
}

type ErrorResult

type ErrorResult struct {
	Parameters []EMessage `json:"parameters-ibm"`
	PathsIBM   []EMessage `json:"paths-ibm"`
	Paths      []WMessage `json:"paths"`
	Schemas    []EMessage `json:"schema-ibm"`
	FormData   []WMessage `json:"form-data"`
	WalkerIBM  []EMessage `json:"walker-ibm"`
}

type IBMLint

type IBMLint struct {
	LinterErrors   ErrorResult   `json:"errors"`
	LinterWarnings WarningResult `json:"warnings"`
}

The Lint struct is used to parse the structured json data from the IBM linter output. Documentation for IBM's openapi-validator results: https://github.com/IBM/openapi-validator#validation-results

type Linter

type Linter struct {
	Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
	// contains filtered or unexported fields
}

func AIPLintV2

func AIPLintV2(document *pb.Document) (*Linter, int)

AIPLintV2 accepts an OpenAPI v2 document and will call the individual AIP rules on the document.

func AIPLintV3

func AIPLintV3(document *openapi_v3.Document) (*Linter, int)

AIPLintV3 accepts an OpenAPI v2 document and will call the individual AIP rules on the document.

func (*Linter) Descriptor deprecated

func (*Linter) Descriptor() ([]byte, []int)

Deprecated: Use Linter.ProtoReflect.Descriptor instead.

func (*Linter) GetMessages

func (x *Linter) GetMessages() []*Message

func (*Linter) ProtoMessage

func (*Linter) ProtoMessage()

func (*Linter) ProtoReflect

func (x *Linter) ProtoReflect() protoreflect.Message

func (*Linter) Reset

func (x *Linter) Reset()

func (*Linter) String

func (x *Linter) String() string

type Message

type Message struct {
	Type       string   `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Message    string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Suggestion string   `protobuf:"bytes,3,opt,name=suggestion,proto3" json:"suggestion,omitempty"`
	Keys       []string `protobuf:"bytes,4,rep,name=keys,proto3" json:"keys,omitempty"`
	Line       int32    `protobuf:"varint,5,opt,name=line,proto3" json:"line,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

func (*Message) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetKeys

func (x *Message) GetKeys() []string

func (*Message) GetLine

func (x *Message) GetLine() int32

func (*Message) GetMessage

func (x *Message) GetMessage() string

func (*Message) GetSuggestion

func (x *Message) GetSuggestion() string

func (*Message) GetType

func (x *Message) GetType() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type WMessage

type WMessage struct {
	Path    string `json:"path"`
	Message string `json:"message"`
	Line    int    `json:"line"`
}

type WarningResult

type WarningResult struct {
	OperationID      []WMessage `json:"operation-ids"`
	Operations       []WMessage `json:"operation"`
	OperationsShared []WMessage `json:"operations-shared"`
	Refs             []WMessage `json:"refs"`
	Schemas          []EMessage `json:"schema-ibm"`
	PathsIBM         []EMessage `json:"paths-ibm"`
	WalkerIBM        []EMessage `json:"walker-ibm"`
	CircularIBM      []WMessage `json:"circular-references-ibm"`
	Responses        []EMessage `json:"responses"`
	ParametersIBM    []EMessage `json:"parameters-ibm"`
}

Jump to

Keyboard shortcuts

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