gen

package
v0.0.0-...-39def3e Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Summary     string               `json:"summary"`
	Description string               `json:"description"`
	Tags        []string             `json:"tags"`
	Parameters  []*Parameter         `json:"parameters"`
	Responses   map[string]*Response `json:"responses"`
}

type Generator

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

type GoAction

type GoAction struct {
	Path      string
	Verb      string
	Name      string
	Action    *Action
	Body      *GoType
	Url       []*PathPart
	Query     []*GoParam
	Responses map[int]*GoActionResponse
}

func (*GoAction) Params

func (a *GoAction) Params() (path []*PathPart, query []*GoParam)

func (*GoAction) ResponseList

func (a *GoAction) ResponseList() []*GoActionResponse

type GoActionResponse

type GoActionResponse struct {
	Code     int
	Type     *GoType
	Response *Response
}

type GoParam

type GoParam struct {
	Name      string
	GoName    string
	Type      *GoType
	Parameter *Parameter
}

type GoType

type GoType struct {
	Name      string
	GoName    string
	GoType    string
	Primitive bool
	Array     bool
	Schema    *Schema
	Items     *GoType
	Props     []*Prop
}

func (*GoType) IsAny

func (g *GoType) IsAny() bool

func (*GoType) IsObject

func (g *GoType) IsObject() bool

type Parameter

type Parameter struct {
	In          string  `json:"in"`
	Name        string  `json:"name"`
	Required    bool    `json:"required"`
	Description string  `json:"description"`
	Type        Type    `json:"type"`
	Schema      *Schema `json:"schema"`
}

type Path

type Path struct {
	Get     *Action `json:"get"`
	Post    *Action `json:"post"`
	Put     *Action `json:"put"`
	Patch   *Action `json:"patch"`
	Delete  *Action `json:"delete"`
	Trace   *Action `json:"trace"`
	Head    *Action `json:"head"`
	Options *Action `json:"options"`
	Connect *Action `json:"connect"`
}

type PathPart

type PathPart struct {
	Literal string
	Param   *GoParam
}

type Prop

type Prop struct {
	Name      string
	FieldName string
	Type      *GoType
	Schema    *Schema
}

type Resolver

type Resolver struct {
	Spec    *Spec
	Arrays  map[string]*GoType
	Objects map[string]*GoType
	Refs    map[string]*GoType
	Defs    map[string]*Schema
	Actions map[string]*GoAction
}

func NewResolver

func NewResolver(spec *Spec) (*Resolver, error)

type Response

type Response struct {
	Description string  `json:"description"`
	Schema      *Schema `json:"schema"`
}

type Schema

type Schema struct {
	Name        string
	Ref         string             `json:"$ref"`
	Type        Type               `json:"type"`
	Description string             `json:"description"`
	Example     interface{}        `json:"example"`
	Properties  map[string]*Schema `json:"properties"`
	Items       *Schema            `json:"items"`
}

type Spec

type Spec struct {
	BasePath string   `json:"basePath"`
	Host     string   `json:"host"`
	Produces []string `json:"produces"`
	Name     string   `json:"name"`
	Schemes  []string `json:"schemes"`
	Info     struct {
		Title       string `json:"title"`
		Description string `json:"description"`
		Version     string `json:"version"`
	} `json:"info"`
	Paths       map[string]*Path   `json:"paths"`
	Definitions map[string]*Schema `json:"definitions"`
}

type Type

type Type string
const (
	TypeObject Type = "object"
	TypeArray  Type = "array"
	TypeString Type = "string"
	TypeBool   Type = "boolean"
	TypeNumber Type = "number"
	TypeInt    Type = "integer"
)

type WriteLine

type WriteLine func(s string, p ...interface{})

Jump to

Keyboard shortcuts

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