specscanner

package
v0.0.0-...-abd191e Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package specscanner provides a generic way to scan a swagger spec. It provides a Handler interface that can be implemented to receive callbacks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(specData []byte, handler Handler, logger *zap.Logger) error

Scan will scan the given spec data and call the implemented methods on the given handler specData should be the raw bytes of the swagger spec JSON

Types

type Handler

type Handler interface {
	StartScan(apiSpec *spec.Swagger) error
	EndScan() error
}

Handler is the interface that should be implemented to receive callbacks when scanning a swagger spec.

type OperationHandler

type OperationHandler interface {
	StartOp(op string, opSpec *spec.Operation) error
	EndOp() error
}

OperationHandler is an optional interface that can be implemented to receive callbacks when the scanner encounters a new operation.

type ParamHandler

type ParamHandler interface {
	StartParam(getSpec *spec.Parameter) error
	EndParam() error
}

ParamHandler is an optional interface that can be implemented to receive callbacks when the scanner encounters a new parameter.

type PathHandler

type PathHandler interface {
	StartPath(path string, pathSpec spec.PathItem) error
	EndPath() error
}

PathHandler is an optional interface that can be implemented to receive callbacks when the scanner encounters a new path.

type ResponseHandler

type ResponseHandler interface {
	StartResponse(statusCode int, getSpec *spec.Response) error
	EndResponse() error
}

ResponseHandler is an optional interface that can be implemented to receive callbacks when the scanner encounters a new response.

Jump to

Keyboard shortcuts

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