package linter
import "github.com/google/gnostic/metrics/lint"
Index ¶
- Variables
- func LintOpenAPIValidator(filename string)
- func LintSpectral(filename string)
- type EMessage
- type ErrorResult
- type IBMLint
- type Linter
- func AIPLintV2(document *pb.Document) (*Linter, int)
- func AIPLintV3(document *openapi_v3.Document) (*Linter, int)
- func (*Linter) Descriptor() ([]byte, []int)
- func (x *Linter) GetMessages() []*Message
- func (*Linter) ProtoMessage()
- func (x *Linter) ProtoReflect() protoreflect.Message
- func (x *Linter) Reset()
- func (x *Linter) String() string
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (x *Message) GetKeys() []string
- func (x *Message) GetLine() int32
- func (x *Message) GetMessage() string
- func (x *Message) GetSuggestion() string
- func (x *Message) GetType() string
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (x *Message) Reset()
- func (x *Message) String() string
- type WMessage
- type WarningResult
Variables ¶
var File_linter_proto protoreflect.FileDescriptor
Functions ¶
func LintOpenAPIValidator ¶
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 ¶
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: Use Linter.ProtoReflect.Descriptor instead.
func (*Linter) GetMessages ¶
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 ¶
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: Use Message.ProtoReflect.Descriptor instead.
func (*Message) GetKeys ¶
func (*Message) GetLine ¶
func (*Message) GetMessage ¶
func (*Message) GetSuggestion ¶
func (*Message) GetType ¶
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 ¶
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"` []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"` }
Source Files ¶
aip-linterv2.go aip-linterv3.go linter.pb.go openapi-validator.go spectral.go
- Version
- v0.7.0 (latest)
- Published
- Aug 25, 2023
- Platform
- linux/amd64
- Imports
- 18 packages
- Last checked
- 1 week ago –
Tools for package owners.