openapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components

type Components struct {
	Schemas   map[string]*Schema
	Responses map[string]*Response
}

type Info

type Info struct {
	Title   string
	Version string
	NoAuth  bool
}

type Media

type Media struct {
	Schema *Schema
}

func NewMedia

func NewMedia(schema *Schema) *Media

func (*Media) String

func (m *Media) String(prefixSpacing int) string

type Openapi

type Openapi struct {
	Info              *Info
	Servers           []*Server
	PathItems         map[string]map[string]*Operation `yaml:"paths"`
	Components        *Components
	ServiceExtensions *pocket.ServiceExtensions
}

func FromProto

func FromProto(file *protogen.File, plugin *protogen.Plugin) (*Openapi, error)

func (*Openapi) HasAuth

func (o *Openapi) HasAuth() bool

func (*Openapi) SecurityScheme

func (o *Openapi) SecurityScheme(tabSize int) string

type Operation

type Operation struct {
	Name            string
	Summary         string `yaml:"summary"`
	Description     string `yaml:"description"`
	Id              string `yaml:"operationId"`
	Tags            []string
	Parameters      []*Parameter
	Responses       map[string]*Response
	RequestBody     *RequestBody          `yaml:"requestBody"`
	SecuritySchemes []map[string][]string `yaml:"security"`
	// contains filtered or unexported fields
}

func (*Operation) HasRequestBody

func (o *Operation) HasRequestBody() bool

func (*Operation) ResponseErrorCodes

func (o *Operation) ResponseErrorCodes() []string

func (*Operation) Schemas

func (o *Operation) Schemas() []string

Schemas returns all schemas that are referenced across this Operation object.

type Parameter

type Parameter struct {
	Required    bool
	Location    string `yaml:"in"`
	Name        string
	Description string
	Schema      *Schema
}

type RequestBody

type RequestBody struct {
	Required    bool
	Description string
	Content     map[string]*Media
}

type Response

type Response struct {
	Description string
	Content     map[string]*Media
}

type Schema

type Schema struct {
	Minimum     int                `yaml:"minimum,omitempty"`
	Maximum     int                `yaml:"maximum,omitempty"`
	Type        string             `yaml:"type,omitempty"`
	Format      string             `yaml:"format,omitempty"`
	Ref         string             `yaml:"$ref,omitempty"`
	Description string             `yaml:"description,omitempty"`
	Example     string             `yaml:"example,omitempty"`
	Items       *Schema            `yaml:"items,omitempty"`
	Enum        []string           `yaml:"enum,omitempty"`
	Required    []string           `yaml:"required,omitempty"`
	Properties  map[string]*Schema `yaml:"properties,omitempty"`
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema(options *SchemaOptions) *Schema

func (*Schema) HasItems

func (s *Schema) HasItems() bool

func (*Schema) HasRequiredProperty

func (s *Schema) HasRequiredProperty() bool

func (*Schema) IsRequired

func (s *Schema) IsRequired() bool

func (*Schema) RefName

func (s *Schema) RefName() string

func (*Schema) RequiredProperties

func (s *Schema) RequiredProperties() []*Schema

func (*Schema) SchemaType

func (s *Schema) SchemaType() SchemaType

func (*Schema) String

func (s *Schema) String(prefixSpacing int) string

type SchemaOptions

type SchemaOptions struct {
	Required    bool
	Minimum     int
	Maximum     int
	Type        SchemaType
	Format      string
	Ref         string
	Description string
	Example     string
	Properties  map[string]*Schema
	Enum        []string
	Items       *Schema
}

type SchemaType

type SchemaType int
const (
	SchemaType_Unspecified SchemaType = iota
	SchemaType_Object
	SchemaType_String
	SchemaType_Array
	SchemaType_Bool
	SchemaType_Integer
	SchemaType_Number
)

func (SchemaType) String

func (s SchemaType) String() string

type Server

type Server struct {
	Url         string
	Description string
}

type Settings

type Settings struct {
	Info    *SettingsInfo
	Servers []*SettingsServer
}

type SettingsInfo

type SettingsInfo struct {
	Title   string
	Version string
}

type SettingsServer

type SettingsServer struct {
	URL         string
	Description string
}

Jump to

Keyboard shortcuts

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