transforms

package
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: 9 Imported by: 1

README

Package cloudeng.io/webapi/openapi/transforms

import cloudeng.io/webapi/openapi/transforms

Functions

Func List
func List() []string

List returns a list of all available transformers.

Func Register
func Register(t T)

Register registers a transformer and make it available to clients of this package.

Types

Type Config
type Config struct {
	Configs    []yaml.Node `yaml:"configs"`
	Transforms []string
}

Config represents the loaded transformer configuration.

Functions
func LoadConfigFile(filename string) (Config, error)

LoadConfigFile loads the transform configuration from the specified YAML file.

func ParseConfig(data []byte) (Config, error)

ParseConfig parses the supplied YAML data to create an instance of Config.

Methods
func (c Config) ConfigureAll() error

ConfigureAll configures all of the transformers currently registered.

Type Replacement
type Replacement struct {
	// contains filtered or unexported fields
}

Replacement represents a replacement string of the form ///

Functions
func NewReplacement(s string) (Replacement, error)

NewReplacement accepts a string of the form /// to create a Replacement that will apply <match-re.ReplaceAllString().

Methods
func (sr Replacement) MatchString(input string) bool

Match applies regexp.MatchString.

func (sr Replacement) ReplaceAllString(input string) string

ReplaceAllString(input string) applies regexp.ReplaceAllString.

Type T
type T interface {
	Name() string
	Describe(node yaml.Node) string
	Configure(node yaml.Node) error
	Transform(*openapi3.T) (*openapi3.T, error)
}

T represents a 'Transformer' that can be used to perform structured edits/transforms on an openapi 3 specification.

Functions
func Get(name string) T

Get returns the transformer, if any, for the requested name. It returns nil if no transformer with that name has been registered.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

List returns a list of all available transformers.

func Register

func Register(t T)

Register registers a transformer and make it available to clients of this package.

Types

type Config

type Config struct {
	Configs    []yaml.Node `yaml:"configs"`
	Transforms []string
}

Config represents the loaded transformer configuration.

func LoadConfigFile

func LoadConfigFile(filename string) (Config, error)

LoadConfigFile loads the transform configuration from the specified YAML file.

func ParseConfig

func ParseConfig(data []byte) (Config, error)

ParseConfig parses the supplied YAML data to create an instance of Config.

func (Config) ConfigureAll

func (c Config) ConfigureAll() error

ConfigureAll configures all of the transformers currently registered.

type Replacement

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

Replacement represents a replacement string of the form /<match-re>/<replacement>/

func NewReplacement

func NewReplacement(s string) (Replacement, error)

NewReplacement accepts a string of the form /<match-re>/<replacement>/ to create a Replacement that will apply <match-re.ReplaceAllString(<replace>).

func (Replacement) MatchString

func (sr Replacement) MatchString(input string) bool

Match applies regexp.MatchString.

func (Replacement) ReplaceAllString

func (sr Replacement) ReplaceAllString(input string) string

ReplaceAllString(input string) applies regexp.ReplaceAllString.

type T

type T interface {
	Name() string
	Describe(node yaml.Node) string
	Configure(node yaml.Node) error
	Transform(*openapi3.T) (*openapi3.T, error)
}

T represents a 'Transformer' that can be used to perform structured edits/transforms on an openapi 3 specification.

func Get

func Get(name string) T

Get returns the transformer, if any, for the requested name. It returns nil if no transformer with that name has been registered.

Jump to

Keyboard shortcuts

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