parser

package
v0.0.0-...-cd0f9f2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InBody     = "body"
	InFormData = "formData"
	InPath     = "path"
	InQuery    = "query"
	InHeader   = "header"
)
View Source
const DefaultOperationClass = "http"
View Source
const OAuth2 = "oauth2"

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayItem

type ArrayItem struct {
	Type   string
	Format string
	Ref    string
}

type Command

type Command struct {
	Name        string
	Description string
	IsTag       bool
}

top level commands / sub commands this could either be a tag or a direct command

type Definition

type Definition struct {
	Type       string
	Required   []string
	Properties map[string]*Property
}

type Extension

type Extension struct {
	Class string
}

type Method

type Method struct {
	Summary     string
	Description string
	OperationId string
	Tags        []string
	Parameters  []Parameter
	MethodName  string
	Consumes    []string
	Path        string
	Extension   *Extension
	Securities  []map[string][]string
}

func (*Method) GetExtensionClass

func (m *Method) GetExtensionClass() string

func (*Method) HasExtension

func (m *Method) HasExtension() bool

func (*Method) HasSecurity

func (m *Method) HasSecurity() bool

func (*Method) NeedJwt

func (m *Method) NeedJwt(r *Root) bool

type Parameter

type Parameter struct {
	Name        string
	Description string
	Required    bool
	In          string
	Type        string
	Format      string
	Schema      *Schema
	Default     interface{}
}

func (*Parameter) DefaultStr

func (p *Parameter) DefaultStr() string

func (*Parameter) GetDescription

func (p *Parameter) GetDescription() string

type Path

type Path struct {
	Get     *Method
	Delete  *Method
	Options *Method
	Patch   *Method
	Post    *Method
	Put     *Method
}

type Property

type Property struct {
	Type        string
	Format      string
	Description string
	Ref         string
	Items       *ArrayItem
}

type Root

type Root struct {
	Host                string
	BasePath            string
	Schemes             []string
	Paths               map[string]*Path
	Tags                []Tag
	Definitions         map[string]Definition
	SecurityDefinitions map[string]SecurityDefinition
}

func ReadSwagger

func ReadSwagger(f string) (*Root, error)

func (*Root) GetCommands

func (r *Root) GetCommands() []*Command

func (*Root) GetOperation

func (r *Root) GetOperation(tag, operation string) (*Method, error)

func (*Root) GetTaggedCommands

func (r *Root) GetTaggedCommands(tag string) ([]*Method, error)

func (*Root) NeedJwt

func (r *Root) NeedJwt(s string) bool

func (*Root) ShowTags

func (r *Root) ShowTags()

type Schema

type Schema struct {
	Ref        string
	Definition *Definition
}

struct defs

type SecurityDefinition

type SecurityDefinition struct {
	Type string
}

type Tag

type Tag struct {
	Name        string
	Description string
}

Jump to

Keyboard shortcuts

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