convertoas3

package
v0.0.0-...-bc93277 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const JSONSchemaVersion = "draft4"

Variables

This section is empty.

Functions

func Convert

func Convert(content *[]byte, opts O2kOptions) (map[string]interface{}, error)

Convert converts an OpenAPI spec to a Kong declarative file.

func CreateKongService

func CreateKongService(
	baseName string,
	servers *openapi3.Servers,
	serviceDefaults []byte,
	upstreamDefaults []byte,
	tags []string,
	uuidNamespace uuid.UUID,
) (map[string]interface{}, map[string]interface{}, error)

CreateKongService creates a new Kong service entity, and optional upstream. `baseName` will be used as the name of the service (slugified), and as input for the UUIDv5 generation.

func MustConvert

func MustConvert(content *[]byte, opts O2kOptions) map[string]interface{}

MustConvert is the same as Convert, but will panic if an error is returned.

func Slugify

func Slugify(name ...string) string

Slugify converts a name to a valid Kong name by removing and replacing unallowed characters and sanitizing non-latin characters. Multiple inputs will be concatenated using '_'.

Types

type O2kOptions

type O2kOptions struct {
	Tags          *[]string // Array of tags to mark all generated entities with, taken from 'x-kong-tags' if omitted.
	DocName       string    // Base document name, will be taken from x-kong-name, or info.title (for UUID generation!)
	UUIDNamespace uuid.UUID // Namespace for UUID generation, defaults to DNS namespace for UUID v5
}

O2KOptions defines the options for an O2K conversion operation

Jump to

Keyboard shortcuts

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