cyswag

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

dynaswag/schema.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(opts ...RegisterOption)

Types

type APIEndpoint

type APIEndpoint struct {
	Path        string
	Method      string
	Summary     string
	Description string
	Tags        []string
	Request     any
	Response    any
}

type Generator

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

func NewGenerator

func NewGenerator(title, version string) *Generator

func (*Generator) AddAPI

func (g *Generator) AddAPI(api APIEndpoint) *Generator

func (*Generator) BasePath

func (g *Generator) BasePath(path string) *Generator

func (*Generator) GenerateTemplate

func (g *Generator) GenerateTemplate() string

func (*Generator) Host

func (g *Generator) Host(host string) *Generator

func (*Generator) Scheme

func (g *Generator) Scheme(s ...string) *Generator

type Parameter

type Parameter struct {
	Name        string      `json:"name"`
	In          string      `json:"in"`
	Description string      `json:"description,omitempty"`
	Required    bool        `json:"required"`
	Type        string      `json:"type,omitempty"`
	Format      string      `json:"format,omitempty"`
	Schema      interface{} `json:"schema,omitempty"`
	Enum        []string    `json:"enum,omitempty"`
}

type RegisterOption

type RegisterOption func(*Generator)

func WithApiEndpoint

func WithApiEndpoint(api ...APIEndpoint) RegisterOption

func WithBasePath

func WithBasePath(basePath string) RegisterOption

func WithHost

func WithHost(host string) RegisterOption

func WithScheme

func WithScheme(schemes ...string) RegisterOption

func WithTitle

func WithTitle(title string) RegisterOption

func WithVersion

func WithVersion(version string) RegisterOption

type StructParams

type StructParams struct {
	Params     []Parameter
	StructName string
	Schema     map[string]interface{}
}

func ParseParameters

func ParseParameters(req any) *StructParams

Jump to

Keyboard shortcuts

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