genopenapi

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: BSD-3-Clause Imports: 35 Imported by: 0

Documentation

Overview

Package genopenapi provides a code generator for OpenAPI v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddErrorDefs

func AddErrorDefs(reg *descriptor.Registry) error

AddErrorDefs Adds google.rpc.Status and google.protobuf.Any to registry (used for error-related API responses)

func LookupNamingStrategy added in v1.0.4

func LookupNamingStrategy(strategyName string) func([]string) map[string]string

LookupNamingStrategy looks up the given naming strategy and returns the naming strategy function for it. The naming strategy function takes in the list of all fully-qualified proto message names, and returns a mapping from fully-qualified name to OpenAPI name.

func New

func New(reg *descriptor.Registry, format Format) gen.Generator

New returns a new generator which generates grpc gateway files.

Types

type ContentEncoder added in v1.0.4

type ContentEncoder interface {
	Encode(v interface{}) (err error)
}

type Format added in v1.0.4

type Format string
const (
	FormatJSON Format = "json"
	FormatYAML Format = "yaml"
)

func (Format) NewEncoder added in v1.0.4

func (f Format) NewEncoder(w io.Writer) (ContentEncoder, error)

func (Format) Validate added in v1.0.4

func (f Format) Validate() error

type GeneratorOptions added in v1.0.4

type GeneratorOptions struct {
	Registry       *descriptor.Registry
	RecursiveDepth int
}

type RawExample added in v1.0.4

type RawExample json.RawMessage

func (RawExample) MarshalJSON added in v1.0.4

func (m RawExample) MarshalJSON() ([]byte, error)

func (RawExample) MarshalYAML added in v1.0.4

func (e RawExample) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

It converts RawExample to one of yaml-supported types and returns it.

From yaml.Marshaler docs: The Marshaler interface may be implemented by types to customize their behavior when being marshaled into a YAML document. The returned value is marshaled in place of the original value implementing Marshaler.

func (*RawExample) UnmarshalJSON added in v1.0.4

func (m *RawExample) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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