validator

package
v0.0.0-...-5d48a22 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGoLangSourceFileReader

func NewGoLangSourceFileReader(fileName string, ignoredLines *IgnoredLines) *golangSourceFileReader

NewGoLangSourceFileReader Returns a new golangSourceFileReader

func NewGoSourceAPILine

func NewGoSourceAPILine(fileName string, fullLine string, lineNum int, httpMethod string, apiPath string) *goSourceAPILine

NewGoSourceAPILine Returns a new goSourceAPILine

func NewOASModel

func NewOASModel(specFile string) *oasModel

NewOASModel Returns a new oasModel

func ReadFile

func ReadFile(filename string) (error, []string)

ReadFile Reads file contents and returns its contents as an array of strings.

Types

type DiffWorker

type DiffWorker struct {
	// contains filtered or unexported fields
}

DiffWorker Structure for use as inputs by diff worker, consisting of definitions found in code, specs and api definitions to be ignored

func NewDiffWorker

func NewDiffWorker(codeAPIDefs []*goSourceAPILine, specAPIDefs []string, ignoredAPIDefs *IgnoredAPIPaths) *DiffWorker

NewDiffWorker Returns a new DiffWorker

func (*DiffWorker) ValidateCodeDefsNotInSpec

func (v *DiffWorker) ValidateCodeDefsNotInSpec() (error, []string)

ValidateCodeDefsNotInSpec Returns api paths found in code but not defined in spec

func (*DiffWorker) ValidateSpecDefsNotInCode

func (v *DiffWorker) ValidateSpecDefsNotInCode() (error, []string)

ValidateSpecDefsNotInCode Returns api paths defined in spec but not found in code

type GoSourceScanner

type GoSourceScanner struct {
	// contains filtered or unexported fields
}

GoSourceScanner Structure to specify root golang source directory and directories/files/lines to be ignored for scanning of API path definitions

func NewGoSourceScanner

func NewGoSourceScanner(dir string, ignoredDirectories *IgnoredDirectories, ignoredFiles *IgnoredFiles, ignoredLines *IgnoredLines) *GoSourceScanner

NewGoSourceScanner Returns a new GoSourceScanner

func (*GoSourceScanner) ScanSourcesForAPIDefs

func (gss *GoSourceScanner) ScanSourcesForAPIDefs() (error, []*goSourceAPILine)

ScanSourcesForAPIDefs Recursively walks the directory, analyzes golang source files to find API definitions ignoring directories found in .dirignore, ignoring files in .fileignore, ignoring lines in .lineignore

type IgnoredAPIPaths

type IgnoredAPIPaths struct {
	// contains filtered or unexported fields
}

IgnoredAPIPaths Array of API paths to be ignored while working out diffs between code and specs

func NewIgnoredAPIRoutes

func NewIgnoredAPIRoutes(ignoredAPIPathsFile string) (error, *IgnoredAPIPaths)

NewIgnoredAPIRoutes Returns a new IgnoredAPIPaths

type IgnoredDirectories

type IgnoredDirectories struct {
	// contains filtered or unexported fields
}

IgnoredDirectories Directories to be ignored while coming up with diffs e.g. /bin, /out

func NewIgnoredDirectories

func NewIgnoredDirectories(ignoreDirFileName string) (error, *IgnoredDirectories)

NewIgnoredDirectories Returns new IgnoredDirectories

type IgnoredFiles

type IgnoredFiles struct {
	// contains filtered or unexported fields
}

IgnoredFiles Files to be ignored while coming up with diffs

func NewIgnoredFiles

func NewIgnoredFiles(ignoreFilesFileName string) (error, *IgnoredFiles)

NewIgnoredFiles Returns new IgnoredFiles

type IgnoredLines

type IgnoredLines struct {
	// contains filtered or unexported fields
}

IgnoredLines Files to be ignored while coming up with diffs

func NewIgnoredLines

func NewIgnoredLines(ignoredLinesFileName string) (error, *IgnoredLines)

NewIgnoredLines Returns new IgnoredLines

type OpenAPISpecCodeDiffsResult

type OpenAPISpecCodeDiffsResult struct {
	SpecDefsNotInCode []string
	CodeDefsNotSpec   []string
}

OpenAPISpecCodeDiffsResult Represents results of diff operation between golang source code and OpenAPI Specs

type OpenAPISpecCodeDiffsValidator

type OpenAPISpecCodeDiffsValidator struct {
	// contains filtered or unexported fields
}

OpenAPISpecCodeDiffsValidator The main input struct for this validation tool

func NewOpenAPISpecCodeDiffsValidator

func NewOpenAPISpecCodeDiffsValidator(ignoredDirFile string, ignoredFilesFile string, ignoredLinesFile string, ignoredAPIPathsFile string, goSourcesDir string, oasSpecFile string) *OpenAPISpecCodeDiffsValidator

NewOpenAPISpecCodeDiffsValidator Returns a new OpenAPISpecCodeDiffsValidator

func (*OpenAPISpecCodeDiffsValidator) Validate

Validate main validation function that sets up the validation tool and returns the diff result

Jump to

Keyboard shortcuts

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