openapi

package
v0.0.0-...-4977aea Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, repo Repository, host string, port int) (net.Listener, <-chan error)

Serve starts a server that serves the repo

Types

type KeyNotFoundError

type KeyNotFoundError struct {
	Repo string
	Key  string
}

KeyNotFoundError is returned when a key is not found

func (KeyNotFoundError) Error

func (e KeyNotFoundError) Error() string

type KeyUrls

type KeyUrls struct {
	Key  string `json:"key"`
	Name string `json:"name"`
	Path string `json:"path"`
}

KeyUrls is returned in the Keys endpoint

type Repository

type Repository interface {
	Keys() []SpecMetadata
	Spec(key string) (Spec, error)
}

Repository abstracts a documentation provider holding keys and specs

type Spec

type Spec interface {
	Get() ([]byte, error)
}

Spec is the openApi spec abstraction

func Cached

func Cached(delegate Spec, ttl time.Duration) Spec

Cached returns a spec that wraps and caches the delegate spec

func NewCachedRemoteSpec

func NewCachedRemoteSpec(url string, ttl time.Duration) Spec

NewCachedRemoteSpec is a convenience constructor for a cached remote spec

func NewRemoteSpec

func NewRemoteSpec(url string) Spec

NewRemoteSpec creates a spec that is proxied from a remote url

type SpecMetadata

type SpecMetadata struct {
	Key, Name string
}

SpecMetadata contains metadata regarding the spec

func SpecMetadataOf

func SpecMetadataOf(name string) SpecMetadata

SpecMetadataOf name

type SpecRepoStore

type SpecRepoStore interface {
	SpecStore
	Repository
}

SpecRepoStore combined

func NewCachedRepository

func NewCachedRepository() SpecRepoStore

NewCachedRepository creats a new CachedRepo

type SpecStore

type SpecStore interface {
	Put(source, key string, spec Spec) error
	ReplaceAllOf(source string, specs map[string]Spec)
	Remove(source, key string) error
	RemoveAllOf(source string)
}

SpecStore is a concurrent Spec store

func Logging

func Logging(delegate SpecStore) SpecStore

Logging wraps the Spec Store in a logging spec store

Jump to

Keyboard shortcuts

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