Help us shape the future of Go! Take the 2026 Go Developer Survey

openapi

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package openapi implements OpenAPI server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIError

func APIError(code int32, msg string) *model.Error

APIError returns model.Error with given code and msg.

func ErrPayload

func ErrPayload(err error) interface{}

ErrPayload returns err.Payload or *model.Error(nil) or err for unknown errors.

func InitMetrics

func InitMetrics(reg *prometheus.Registry, namespace string)

InitMetrics must be called once before using this package. It registers and initializes metrics used by this package.

func NewServer

func NewServer(appl app.Appl, cfg Config) (*restapi.Server, error)

NewServer returns OpenAPI server configured to listen on the TCP network address cfg.Host:cfg.Port and handle requests on incoming connections.

Types

type Config

type Config struct {
	APIKeyAdmin string
	Addr        netx.Addr
	BasePath    string
}

Config contains configuration for OpenAPI server.

type Ctx

type Ctx = context.Context

Ctx is a synonym for convenience.

type Log

type Log = *structlog.Logger

Log is a synonym for convenience.

Jump to

Keyboard shortcuts

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