Documentation
¶
Index ¶
- func Define[T interface{ ... }](name string, t T) T
- func ToGocode(w io.Writer, b *Builder) error
- func ToSchema(b *Builder) (*orderedmap.OrderedMap, error)
- func ToSchemaWith(doc *orderedmap.OrderedMap, b *Builder, useRef bool) (*orderedmap.OrderedMap, error)
- func ToString(t TypeBuilder) string
- type Action
- type ActionMetadata
- type Array
- type ArrayMetadata
- type Body
- type BodyMetadata
- type Bool
- type BoolMetadata
- type Builder
- func (b *Builder) Action(name string, inputoroutput ...InputOrOutput) *Action
- func (b *Builder) AllOf(types ...Type) *_Container
- func (b *Builder) AnyOf(types ...Type) *_Container
- func (b *Builder) Array(items Type) *Array[Type]
- func (b *Builder) Body(typ Type) *Body
- func (b *Builder) Bool() *Bool
- func (b *Builder) EachTypes(fn func(TypeBuilder) error) error
- func (b *Builder) Extension(name string, value any) *Extension
- func (b *Builder) Field(name string, typ Type) *Field
- func (b *Builder) Float() *Float
- func (b *Builder) Input(params ...paramOrBody) *Input
- func (b *Builder) Int() *Int
- func (b *Builder) IntFromEnum(enum *enumgen.Int) *Int
- func (b *Builder) Map(items Type) *Map[Type]
- func (b *Builder) Object(fields ...*Field) *Object
- func (b *Builder) OneOf(types ...Type) *_Container
- func (b *Builder) Output(typ Type) *Output
- func (b *Builder) Param(name string, typ Type) *Param
- func (b *Builder) Reference(typ TypeBuilder) *TypeRef
- func (b *Builder) ReferenceByName(name string) *TypeRef
- func (b *Builder) String() *String
- func (b *Builder) StringFromEnum(enum *enumgen.String) *String
- type Config
- type Contact
- type Extension
- type ExtensionMetadata
- type Field
- func (b Field) AllowEmptyValue(value bool) R
- func (b Field) Deprecated(value bool) R
- func (b Field) Doc(stmts ...string) R
- func (t *Field) GetMetadata() *FieldMetadata
- func (b Field) Nullable(value bool) R
- func (b Field) ReadOnly(value bool) R
- func (b Field) Required(value bool) R
- func (b Field) WriteOnly(value bool) R
- type FieldMetadata
- type Float
- func (b Float) Default(value string) R
- func (b Float) ExclusiveMax(value bool) R
- func (b Float) ExclusiveMin(value bool) R
- func (b Float) Format(value string) R
- func (t *Float) GetMetadata() *FloatMetadata
- func (b Float) Maximum(value float64) R
- func (b Float) Minimum(value float64) R
- func (b Float) MultipleOf(value float64) R
- type FloatMetadata
- type Info
- type Input
- type InputMetadata
- type InputOrOutput
- type Int
- type IntMetadata
- type License
- type Map
- type MapMetadata
- type Object
- type ObjectMetadata
- type OpenAPI
- type Output
- type OutputMetadata
- type Param
- func (b Param) AllowEmptyValue(value bool) R
- func (b *Param) AsCookie() *Param
- func (b *Param) AsHeader() *Param
- func (b *Param) AsPath() *Param
- func (b *Param) AsQuery() *Param
- func (b Param) Deprecated(value bool) R
- func (b Param) Doc(stmts ...string) R
- func (t *Param) GetMetadata() *ParamMetadata
- func (b Param) In(value string) R
- func (b Param) Required(value bool) R
- type ParamMetadata
- type Router
- func (r *Router) Delete(path string, action *Action)
- func (r *Router) Get(path string, action *Action)
- func (r *Router) Method(method string, path string, action *Action)
- func (r *Router) Patch(path string, action *Action)
- func (r *Router) Post(path string, action *Action)
- func (r *Router) Put(path string, action *Action)
- func (r *Router) Tagged(tags ...string) *Router
- func (r *Router) ToSchemaWith(b *Builder, doc *orderedmap.OrderedMap) error
- type Server
- type String
- type StringMetadata
- type Type
- type TypeBuilder
- type TypeMetadata
- type TypeRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Define ¶ added in v0.0.4
func Define[T interface {
TypeBuilder
storeType(name string)
}](name string, t T) T
Define names Type value.
func ToSchema ¶
func ToSchema(b *Builder) (*orderedmap.OrderedMap, error)
func ToSchemaWith ¶
func ToSchemaWith(doc *orderedmap.OrderedMap, b *Builder, useRef bool) (*orderedmap.OrderedMap, error)
func ToString ¶
func ToString(t TypeBuilder) string
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
func (Action) DefaultError ¶ added in v0.0.3
func (b Action) DefaultError(value Type) R
DefaultError set Metadata.DefaultError
func (*Action) GetMetadata ¶
func (t *Action) GetMetadata() *ActionMetadata
type ActionMetadata ¶
type Array ¶
type Array[Items Type] struct { // contains filtered or unexported fields }
func (*Array[Items]) GetMetadata ¶
func (t *Array[Items]) GetMetadata() *ArrayMetadata
type ArrayMetadata ¶
type Body ¶
type Body struct {
// contains filtered or unexported fields
}
func (*Body) GetMetadata ¶
func (t *Body) GetMetadata() *BodyMetadata
type BodyMetadata ¶
type BodyMetadata struct {
Typ Type `json:"-"`
}
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func (Bool) Default ¶ added in v0.0.3
func (b Bool) Default(value bool) R
Default set Metadata.Default
func (*Bool) GetMetadata ¶
func (t *Bool) GetMetadata() *BoolMetadata
type BoolMetadata ¶
type Builder ¶
type Builder struct {
Config *Config
// contains filtered or unexported fields
}
func NewBuilder ¶ added in v0.0.4
func (*Builder) Action ¶
func (b *Builder) Action(name string, inputoroutput ...InputOrOutput) *Action
Action builds Type for Action
func (*Builder) EachTypes ¶
func (b *Builder) EachTypes(fn func(TypeBuilder) error) error
EachType iterates named Type.
func (*Builder) Reference ¶
func (b *Builder) Reference(typ TypeBuilder) *TypeRef
func (*Builder) ReferenceByName ¶
type Config ¶
type Config struct {
DisableRefLinks bool // if true, does not use $ref links
FuncMap template.FuncMap
Template *template.Template
// contains filtered or unexported fields
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Extension ¶ added in v0.0.4
type Extension struct {
// contains filtered or unexported fields
}
func (*Extension) GetMetadata ¶ added in v0.0.4
func (t *Extension) GetMetadata() *ExtensionMetadata
type ExtensionMetadata ¶ added in v0.0.4
for x-<extension-name>
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
func (Field) AllowEmptyValue ¶ added in v0.0.3
func (b Field) AllowEmptyValue(value bool) R
AllowEmptyValue set Metadata.AllowEmptyValue
func (Field) Deprecated ¶ added in v0.0.3
func (b Field) Deprecated(value bool) R
Deprecated set Metadata.Deprecated
func (*Field) GetMetadata ¶
func (t *Field) GetMetadata() *FieldMetadata
func (Field) Nullable ¶ added in v0.0.3
func (b Field) Nullable(value bool) R
Nullable set Metadata.Nullable
func (Field) ReadOnly ¶ added in v0.0.3
func (b Field) ReadOnly(value bool) R
ReadOnly set Metadata.ReadOnly
type FieldMetadata ¶
type FieldMetadata struct {
Name string `json:"-"`
Typ Type `json:"-"`
Doc string `json:"description,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Required bool `json:"-"`
ReadOnly bool `json:"readonly,omitempty"`
WriteOnly bool `json:"writeonly,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
}
type Float ¶ added in v0.0.2
type Float struct {
// contains filtered or unexported fields
}
func (Float) Default ¶ added in v0.0.3
func (b Float) Default(value string) R
Default set Metadata.Default
func (Float) ExclusiveMax ¶ added in v0.0.3
func (b Float) ExclusiveMax(value bool) R
ExclusiveMax set Metadata.ExclusiveMax
func (Float) ExclusiveMin ¶ added in v0.0.3
func (b Float) ExclusiveMin(value bool) R
ExclusiveMin set Metadata.ExclusiveMin
func (Float) Format ¶ added in v0.0.2
func (b Float) Format(value string) R
Format set Metadata.Format
func (*Float) GetMetadata ¶ added in v0.0.2
func (t *Float) GetMetadata() *FloatMetadata
func (Float) Maximum ¶ added in v0.0.3
func (b Float) Maximum(value float64) R
Maximum set Metadata.Maximum
func (Float) Minimum ¶ added in v0.0.3
func (b Float) Minimum(value float64) R
Minimum set Metadata.Minimum
func (Float) MultipleOf ¶ added in v0.0.3
func (b Float) MultipleOf(value float64) R
MultipleOf set Metadata.MultipleOf
type FloatMetadata ¶ added in v0.0.2
type FloatMetadata struct {
Format string `json:"format,omitempty"`
Default string `json:"default,omitempty"`
Maximum float64 `json:"maximum,omitempty"`
Minimum float64 `json:"minimum,omitempty"`
MultipleOf float64 `json:"multipleOf,omitempty"`
ExclusiveMin bool `json:"exclusiveMin,omitempty"`
ExclusiveMax bool `json:"exclusiveMax,omitempty"`
}
type Info ¶ added in v0.0.2
type Info struct {
// required
Title string `json:"title"`
Summary string `json:"summary,omitempty"`
Doc string `json:"description,omitempty"`
TermsOfService string `json:"termOfService,omitempty"`
Contact *Contact `json:"contact,omitempty"`
License *License `json:"license,omitempty"`
// required
Version string `json:"version"`
}
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
func (*Input) GetMetadata ¶
func (t *Input) GetMetadata() *InputMetadata
type InputMetadata ¶
type InputOrOutput ¶ added in v0.0.3
type InputOrOutput interface {
// contains filtered or unexported methods
}
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
func (Int) Default ¶ added in v0.0.3
func (b Int) Default(value int64) R
Default set Metadata.Default
func (Int) ExclusiveMax ¶ added in v0.0.3
func (b Int) ExclusiveMax(value bool) R
ExclusiveMax set Metadata.ExclusiveMax
func (Int) ExclusiveMin ¶ added in v0.0.3
func (b Int) ExclusiveMin(value bool) R
ExclusiveMin set Metadata.ExclusiveMin
func (*Int) GetMetadata ¶
func (t *Int) GetMetadata() *IntMetadata
type IntMetadata ¶
type IntMetadata struct {
Format string `json:"format,omitempty"`
Enum []int64 `json:"enum,omitempty"`
Default int64 `json:"default,omitempty"`
Maximum int64 `json:"maximum,omitempty"`
Minimum int64 `json:"minimum,omitempty"`
ExclusiveMin bool `json:"exclusiveMin,omitempty"`
ExclusiveMax bool `json:"exclusiveMax,omitempty"`
}
type Map ¶
type Map[Items Type] struct { // contains filtered or unexported fields }
func (*Map[Items]) GetMetadata ¶
func (t *Map[Items]) GetMetadata() *MapMetadata
type MapMetadata ¶
type MapMetadata struct {
Pattern string `json:"pattern,omitempty"`
}
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (*Object) GetMetadata ¶
func (t *Object) GetMetadata() *ObjectMetadata
func (*Object) IgnoreFields ¶
func (Object) MaxProperties ¶ added in v0.0.3
func (b Object) MaxProperties(value uint64) R
MaxProperties set Metadata.MaxProperties
func (Object) MinProperties ¶ added in v0.0.3
func (b Object) MinProperties(value uint64) R
MinProperties set Metadata.MinProperties
func (*Object) OnlyFields ¶
type ObjectMetadata ¶
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
func (*Output) GetMetadata ¶
func (t *Output) GetMetadata() *OutputMetadata
type OutputMetadata ¶
type Param ¶
type Param struct {
// contains filtered or unexported fields
}
func (Param) AllowEmptyValue ¶ added in v0.0.3
func (b Param) AllowEmptyValue(value bool) R
AllowEmptyValue set Metadata.AllowEmptyValue
func (Param) Deprecated ¶ added in v0.0.3
func (b Param) Deprecated(value bool) R
Deprecated set Metadata.Deprecated
func (*Param) GetMetadata ¶
func (t *Param) GetMetadata() *ParamMetadata
type ParamMetadata ¶
type ParamMetadata struct {
Name string `json:"name"`
// openapi's in parameter {query, header, path, cookie} (default is query)
In string `json:"in"`
Typ Type `json:"-"`
Doc string `json:"description,omitempty"`
Required bool `json:"required"`
Deprecated bool `json:"deprecated,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
}
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) ToSchemaWith ¶
func (r *Router) ToSchemaWith(b *Builder, doc *orderedmap.OrderedMap) error
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (String) Default ¶ added in v0.0.3
func (b String) Default(value string) R
Default set Metadata.Default
func (*String) GetMetadata ¶
func (t *String) GetMetadata() *StringMetadata
func (String) MaxLength ¶ added in v0.0.3
func (b String) MaxLength(value int64) R
MaxLength set Metadata.MaxLength
type StringMetadata ¶
type Type ¶ added in v0.0.3
type Type interface {
TypeBuilder
// contains filtered or unexported methods
}
Type is the one of pseudo sum types (union). Type is union of bool | int | float | string | object | array[T] | map[T]
type TypeBuilder ¶
type TypeBuilder interface {
GetTypeMetadata() *TypeMetadata
// contains filtered or unexported methods
}
type TypeMetadata ¶
type TypeMetadata struct {
Name string `json:"-"` // required by reference (and toString)
Doc string `json:"description,omitempty"`
Title string `json:"title,omitempty"`
Example string `json:"example,omitempty"`
Extensions *orderedmap.OrderedMap `json:"-"`
// contains filtered or unexported fields
}
type TypeRef ¶
type TypeRef struct {
Name string
// contains filtered or unexported fields
}
func (*TypeRef) GetTypeMetadata ¶
func (t *TypeRef) GetTypeMetadata() *TypeMetadata
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
_examples
|
|
|
00schema
command
|
|
|
01router
command
|
|
|
02separated
command
|
|
|
03tocode
command
|
|
|
04pagination
command
|
|
|
05oneof
command
|
|
|
cmd
|
|
|
init
command
|
|