spec

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Name            string   `json:"name"`
	Method          string   `json:"method"`
	Path            string   `json:"path"`
	ErrorTypes      []string `json:"errorTypes"`
	ResponseType    string   `json:"responseType"`
	BodyType        string   `json:"bodyType"`
	RequireFormData bool     `json:"requireFormData"`
}

type Route added in v0.8.6

type Route struct {
	Name        string
	Path        string
	Method      string
	ErrorTypes  []pyrin.ErrorType
	Data        any
	Body        any
	RequireForm bool
}

type RouteGroup added in v0.8.6

type RouteGroup struct {
	Router *Router
	Prefix string
}

func NewRouteGroup added in v0.8.6

func NewRouteGroup(router *Router, prefix string) *RouteGroup

func (*RouteGroup) Register added in v0.8.6

func (r *RouteGroup) Register(handlers ...pyrin.Handler)

type Router added in v0.8.6

type Router struct {
	Routes []Route
}

func (*Router) AddRoute added in v0.8.6

func (r *Router) AddRoute(route Route)

func (*Router) Group added in v0.8.6

func (r *Router) Group(prefix string) pyrin.Group

type Server

type Server struct {
	Types     []Type     `json:"types"`
	Endpoints []Endpoint `json:"endpoints"`
}

func GenerateSpec added in v0.8.6

func GenerateSpec(routes []Route) (*Server, error)

type Type

type Type struct {
	Name   string      `json:"name"`
	Extend string      `json:"extend"`
	Fields []TypeField `json:"fields"`
}

type TypeField

type TypeField struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Omit bool   `json:"omit"`
}

Jump to

Keyboard shortcuts

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