openapi

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAPIPackages

func FindAPIPackages() ([]string, error)

func Generate

func Generate(cfg Config) error

Types

type Config

type Config struct {
	Title   string
	Version string
	OutFile string
}

type FieldMeta

type FieldMeta struct {
	Name     string    `json:"name"`
	Type     string    `json:"type"`
	JSON     string    `json:"json,omitempty"`
	Query    string    `json:"query,omitempty"`
	Param    string    `json:"param,omitempty"`
	Header   string    `json:"header,omitempty"`
	Validate string    `json:"validate,omitempty"`
	Nested   *TypeMeta `json:"nested,omitempty"`
}

type RouteMeta

type RouteMeta struct {
	ID          string   `json:"id"`
	Method      string   `json:"method"`
	Path        string   `json:"path"`
	Summary     string   `json:"summary,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`

	Request  *TypeMeta `json:"request,omitempty"`
	Response *TypeMeta `json:"response,omitempty"`

	StatusCode int `json:"status_code"`
}

func LoadRoutes

func LoadRoutes(pkgDir, importPath string) ([]RouteMeta, error)

type SchemaBuilder

type SchemaBuilder struct {
	// contains filtered or unexported fields
}

func NewSchemaBuilder

func NewSchemaBuilder() *SchemaBuilder

func (*SchemaBuilder) BuildFromType

func (b *SchemaBuilder) BuildFromType(t *TypeMeta)

func (*SchemaBuilder) Components

func (b *SchemaBuilder) Components() openapi3.Schemas

func (*SchemaBuilder) Ref

func (b *SchemaBuilder) Ref(name string) *openapi3.SchemaRef

type TypeMeta

type TypeMeta struct {
	Name   string      `json:"name"`
	Fields []FieldMeta `json:"fields,omitempty"`
}

Jump to

Keyboard shortcuts

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