openapi

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

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

README

Package cloudeng.io/webapi/openapi

import cloudeng.io/webapi/openapi

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.

Functions
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.

Functions
func WalkerFollowRefs(v bool) WalkerOption

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

func WalkerTracePaths(v bool) WalkerOption
func WalkerVisitPrefix(path ...string) WalkerOption

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

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