openapi3Struct

package module
v0.0.0-...-bf3d7d7 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 13 Imported by: 0

README

openapi3Struct

Openapi3 struct parser

CLI

Usage:

go run github.com/wexder/openapi3Struct/cmd/openapi3Struct generate --packages=p --output=openapi.yaml

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTypeName

func GetTypeName(v any) string

func ToPointer

func ToPointer[T any](v T) *T

Types

type EndpointDoc

type EndpointDoc struct {
	Path     string
	Version  int
	Method   string
	PathItem *OperationBuilder
}

func (*EndpointDoc) BuildOpenAPiStruct

func (ep *EndpointDoc) BuildOpenAPiStruct() Path

func (*EndpointDoc) GetPath

func (ep *EndpointDoc) GetPath() string

type HandlerProvider

type HandlerProvider any

type OperationBuilder

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

func NewOperationBuilder

func NewOperationBuilder() *OperationBuilder

func (*OperationBuilder) Build

func (ob *OperationBuilder) Build() *openapi3.Operation

func (*OperationBuilder) WithDescription

func (ob *OperationBuilder) WithDescription(desc string) *OperationBuilder

func (*OperationBuilder) WithParameter

func (ob *OperationBuilder) WithParameter(name, in, description string, required bool, schemaType any) *OperationBuilder

func (*OperationBuilder) WithParameterRef

func (ob *OperationBuilder) WithParameterRef(ref string) *OperationBuilder

func (*OperationBuilder) WithRequestBodyType

func (ob *OperationBuilder) WithRequestBodyType(bodyType any, description string, required bool) *OperationBuilder

func (*OperationBuilder) WithResponse

func (ob *OperationBuilder) WithResponse(statusCode int, description string, responseType any) *OperationBuilder

func (*OperationBuilder) WithTags

func (ob *OperationBuilder) WithTags(tags ...string) *OperationBuilder

type Option

type Option func(p Parser) Parser

func WithPackagePaths

func WithPackagePaths(paths []string) Option

type Parser

type Parser struct {
	T openapi3.T
	// contains filtered or unexported fields
}

func NewParser

func NewParser(t openapi3.T, options ...Option) *Parser

func (*Parser) AddPath

func (p *Parser) AddPath(path Path)

func (*Parser) ParseSchemasFromStructs

func (p *Parser) ParseSchemasFromStructs() error

func (*Parser) SaveJsonToFile

func (p *Parser) SaveJsonToFile(path string) error

func (*Parser) SaveYamlToFile

func (p *Parser) SaveYamlToFile(path string) error

func (*Parser) Validate

func (p *Parser) Validate(ctx context.Context) error

Validate resolves refs and validates schema

type Path

type Path struct {
	Path string
	Item openapi3.PathItem
}

Directories

Path Synopsis
cmd
openapi3Struct command

Jump to

Keyboard shortcuts

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