lint

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package lint provides a lint function for OpenAPI Spec 3.

Index

Constants

View Source
const (
	LEVEL_ERROR = 0
	LEVEL_WARN  = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check func(string, *load.SpecInfo) []*Error

type Config

type Config struct {
	Checks []Check
}

func DefaultConfig

func DefaultConfig() *Config

func NewConfig

func NewConfig(checks []Check) *Config

type Error

type Error struct {
	Id      string `json:"id,omitempty" yaml:"id,omitempty"`
	Text    string `json:"text,omitempty" yaml:"text,omitempty"`
	Comment string `json:"comment,omitempty" yaml:"comment,omitempty"`
	Level   int    `json:"level" yaml:"level"`
	Source  string `json:"source,omitempty" yaml:"source,omitempty"`
}

func InfoCheck

func InfoCheck(source string, spec *load.SpecInfo) []*Error

InfoCheck based on REQUIRED fields (Version and Info) from swagger docs, see: https://swagger.io/docs/specification/api-general-info/

func PathParamsCheck

func PathParamsCheck(source string, s *load.SpecInfo) []*Error

func RequiredParamsCheck

func RequiredParamsCheck(source string, s *load.SpecInfo) []*Error

func SchemaCheck

func SchemaCheck(source string, spec *load.SpecInfo) []*Error

type Errors

type Errors []*Error

func Run

func Run(config Config, source string, spec *load.SpecInfo) Errors

func (Errors) Len

func (e Errors) Len() int

func (Errors) Less

func (e Errors) Less(i, j int) bool

func (Errors) Swap

func (e Errors) Swap(i, j int)

Jump to

Keyboard shortcuts

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