openapi

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 15 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   `yaml:"schemas"`
	Responses map[string]*Response `yaml:"responses"`
	Security  map[string]*Security `yaml:"securitySchemes,omitempty"`
}

type Info

type Info struct {
	Title       string `yaml:"title"`
	Version     string `yaml:"version"`
	Description string `yaml:"description,omitempty"`
}

type Media

type Media struct {
	Schema *Schema `json:"schema,omitempty"`
}

type MessageParser

type MessageParser struct {
	Package  *protobuf.Protobuf
	Settings *settings.Settings
	// contains filtered or unexported fields
}

func (*MessageParser) GetMessageSchemas

func (m *MessageParser) GetMessageSchemas(
	message *protobuf.Message,
	httpRule *annotations.HttpRule,
	methodExtensions *mextensionspb.MikrosMethodExtensions,
	pathParameters []string,
) (map[string]*Schema, error)

type Openapi

type Openapi struct {
	Version    string                           `yaml:"openapi"`
	Info       *Info                            `yaml:"info"`
	Servers    []*Server                        `yaml:"servers,omitempty"`
	PathItems  map[string]map[string]*Operation `yaml:"paths,omitempty"`
	Components *Components                      `yaml:"components,omitempty"`
	// contains filtered or unexported fields
}

func FromProto

func FromProto(plugin *protogen.Plugin, settings *settings.Settings) (*Openapi, error)

func (*Openapi) ModuleName

func (o *Openapi) ModuleName() string

type Operation

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

type Parameter

type Parameter struct {
	Required    bool    `yaml:"required"`
	Location    string  `yaml:"in"`
	Name        string  `yaml:"name"`
	Description string  `yaml:"description,omitempty"`
	Schema      *Schema `yaml:"schema,omitempty"`
}

type RequestBody

type RequestBody struct {
	Required    bool              `yaml:"required"`
	Description string            `yaml:"description,omitempty"`
	Content     map[string]*Media `yaml:"content"`
}

type Response

type Response struct {
	Description string            `yaml:"description,omitempty"`
	Content     map[string]*Media `yaml:"content"`
	// contains filtered or unexported fields
}

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"`
	AdditionalProperties *Schema            `yaml:"additionalProperties,omitempty"`
	AnyOf                []*Schema          `yaml:"anyOf,omitempty"`
	Message              *protobuf.Message  `yaml:"-"`
	// contains filtered or unexported fields
}

func (*Schema) GetAdditionalPropertySchemas

func (s *Schema) GetAdditionalPropertySchemas(field *protobuf.Field, parser *MessageParser) (map[string]*Schema, error)

func (*Schema) HasAdditionalProperties

func (s *Schema) HasAdditionalProperties() bool

func (*Schema) IsRequired

func (s *Schema) IsRequired() bool

func (*Schema) ProtoField

func (s *Schema) ProtoField() *protobuf.Field

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 Security

type Security struct {
	Type         string `yaml:"type"`
	Scheme       string `yaml:"scheme"`
	BearerFormat string `yaml:"bearerFormat,omitempty"`
}

type Server

type Server struct {
	Url         string `yaml:"url"`
	Description string `yaml:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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