openapi

package module
v0.0.0-...-c71f559 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

README

openapi

This repository provides support for traversing openapi documents as parsed by https://github.com/getkin/kin-openapi and also for performing various transformations on those documents to work around inconsistent/incorrect schemas (see the transforms package). Such schemas are often generated by schema generator tools that generate specifications from existing code/APIs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsYAML

func AsYAML(indent int, doc any) (string, error)

func FormatV3

func FormatV3(doc *openapi3.T, isYAML bool) ([]byte, error)

Types

type Visitor

type Visitor func(path []string, parent, node any) (ok bool, err error)

Visitor is called for every node in the walk. It returns true for the walk to continue, false otherwise. The walk will stop when an error is returned.

type Walker

type Walker interface {
	Walk(doc *openapi3.T) error
}

Walker represents the interface implemented by all walkers.

func NewWalker

func NewWalker(v Visitor, opts ...WalkerOption) Walker

NewWalker returns a Walker that will visit every node in an openapi3 document.

type WalkerOption

type WalkerOption func(o *walkerOptions)

WalkerOption represents an option for use when creating a new walker.

func WalkerFollowRefs

func WalkerFollowRefs(v bool) WalkerOption

WalkerFollowRefs controls wether the walker will follow $ref's and flatten them in place.

func WalkerTracePaths

func WalkerTracePaths(v bool) WalkerOption

func WalkerVisitPrefix

func WalkerVisitPrefix(path ...string) WalkerOption

WalkerVisitPrefix adds a prefix that the walk should call the Visitor function for. All other paths will be ignored.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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