Documentation
¶
Index ¶
- func ExecuteTemplate(name string, data any) (string, error)
- func NewComponents(spec specification.Components, cfg Config) (zero Components, _ Imports, _ error)
- func NewCustomType(specCustom string, st InternalSchemaType) (CustomType, Imports)
- func NewDateTime(layout string) (DateTime, Imports)
- func NewHandler(o *Operation, basePathPrefix string, components Componenter, cfg Config) (zero *Handler, _ Imports, _ error)
- func NewHandlerHeaderParameter(p *HeaderParameter, cfg Config) (zero HandlerHeaderParameter, _ Imports, _ error)
- func NewHandlerParameters(p OperationParams, cfg Config) (zero HandlerParameters, _ Imports, _ error)
- func NewHandlerPathParameter(p *PathParameter) (zero HandlerPathParameter, _ Imports, _ error)
- func NewHandlerQueryParameter(p *QueryParameter, cfg Config) (zero HandlerQueryParameter, _ Imports, _ error)
- func NewHeaderParameter(sr specification.Ref[specification.HeaderParameter], components Componenter, ...) (zero *HeaderParameter, _ Imports, _ error)
- func NewOperation(s *specification.Operation, components Componenter, cfg Config) (zero *Operation, _ Imports, _ error)
- func NewOperationParams(params specification.OperationParameters, components Componenter, cfg Config) (zero OperationParams, _ Imports, _ error)
- func NewPathParameter(rs specification.Ref[specification.PathParameter], components Componenter, ...) (zero *PathParameter, _ Imports, _ error)
- func NewQueryParameter(refP specification.Ref[specification.QueryParameter], components Componenter, ...) (zero *QueryParameter, _ Imports, _ error)
- func NewResponse(handlerName OperationName, status string, response *specification.Response, ...) (*Response, Imports, error)
- func NewResponseHeader(name string, ref specification.Ref[specification.Header], ...) (zero ResponseHeader, _ Imports, _ error)
- func NewSchema(s specification.Ref[specification.Schema], components Componenter, cfg Config) (zero Schema, _ Imports, _ error)
- func NewStructureField(p specification.SchemaProperty, components Componenter, cfg Config) (zero StructureField, _ Imports, _ error)
- func NewStructureType(s *specification.Schema, components Componenter, cfg Config) (zero StructureType, _ Imports, _ error)
- func PrivateFieldName(name string) string
- func PublicFieldName(name string) string
- func Title(s string) string
- type BoolType
- func (b BoolType) GoType() string
- func (b BoolType) RenderStringParser(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (_ BoolType) RenderToBaseType(from string) (string, error)
- func (b BoolType) RenderToString(from string) (string, error)
- func (_ BoolType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type ClientOperationHeaderTemplate
- type ClientOperationQueryTemplate
- type ClientOperationTemplate
- type ClientResponseHeaderTemplate
- type ClientResponseTemplate
- type ClientTemplate
- type Componenter
- type Components
- type Config
- type CookieParameter
- type CustomType
- func (c CustomType) FuncTypeName() string
- func (c CustomType) Kind() SchemaKind
- func (c CustomType) ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (c CustomType) ParseStrings(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (c CustomType) RenderConvertToBaseSchema(from string) (string, error)
- func (c CustomType) RenderFormat(from string) (string, error)
- func (c CustomType) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (c CustomType) RenderGoType() (string, error)
- func (c CustomType) RenderToBaseType(to, from string) (string, error)
- func (c CustomType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type DateTime
- func (DateTime) GoType() string
- func (d DateTime) RenderStringParser(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (d DateTime) RenderToBaseType(from string) (string, error)
- func (d DateTime) RenderToString(from string) (string, error)
- func (d DateTime) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type ErrorRender
- type FloatType
- func (f FloatType) GoType() string
- func (i FloatType) RenderStringParser(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (_ FloatType) RenderToBaseType(from string) (string, error)
- func (i FloatType) RenderToString(from string) (string, error)
- func (i FloatType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type Formatter
- type FormatterFunc
- type GenOption
- type Generator
- type GeneratorOptions
- type GoFile
- type GoTypeRender
- type GoTypeRenderFunc
- type Handler
- type HandlerHeaderParameter
- type HandlerParameter
- type HandlerParameterHeaderTemplate
- type HandlerParameterPathTemplate
- type HandlerParameterQueryTemplate
- type HandlerParameterTemplate
- type HandlerParameters
- type HandlerPathParameter
- type HandlerQueryParameter
- type HandlerResponse
- type HandlerResponseTemplate
- type HandlerTemplate
- type HandlersFileTemplate
- type HeaderComponent
- type HeaderParameter
- type Import
- type Imports
- type IntType
- func (i IntType) GoType() string
- func (i IntType) RenderStringParser(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (_ IntType) RenderToBaseType(from string) (string, error)
- func (i IntType) RenderToString(from string) (string, error)
- func (i IntType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type InternalSchemaType
- type Maybe
- type NamedComponenter
- type NullableType
- func (n NullableType) FuncTypeName() string
- func (n NullableType) GoType(from string) string
- func (n NullableType) Kind() SchemaKind
- func (n NullableType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (n NullableType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (n NullableType) RenderBaseFrom(prefix, from, suffix string) (string, error)
- func (n NullableType) RenderFormat(from string) (string, error)
- func (n NullableType) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (n NullableType) RenderGoType() (string, error)
- func (n NullableType) RenderToBaseType(to, from string) (string, error)
- func (n NullableType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type Operation
- type OperationName
- type OperationParams
- type OperationPathElement
- type OptionalType
- func (p OptionalType) FuncTypeName() string
- func (p OptionalType) Kind() SchemaKind
- func (p OptionalType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (p OptionalType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (p OptionalType) RenderBaseFrom(prefix, from, suffix string) (string, error)
- func (p OptionalType) RenderConvertToBaseSchema(from string) (string, error)
- func (p OptionalType) RenderFormat(from string) (string, error)
- func (p OptionalType) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (p OptionalType) RenderGoType() (string, error)
- func (p OptionalType) RenderToBaseType(to, from string) (string, error)
- func (p OptionalType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type Parser
- type ParserFunc
- type Path
- type PathItem
- type PathParameter
- type PathParameters
- type PathParserConstant
- type PathParserVariable
- type PathStringBuilder
- type PathV
- type Primitive
- func (t Primitive) FuncTypeName() string
- func (t Primitive) Kind() SchemaKind
- func (t Primitive) ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (t Primitive) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (t Primitive) RenderFormat(from string) (string, error)
- func (t Primitive) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (t Primitive) RenderGoType() (string, error)
- func (t Primitive) RenderToBaseType(to, from string) (string, error)
- func (t Primitive) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type PrimitiveIface
- type QueryParameter
- type Render
- type RenderFunc
- type Renders
- type RequestBodyComponent
- type Response
- type ResponseArg
- type ResponseCode
- type ResponseComponent
- type ResponseContentSchema
- type ResponseHeader
- type ResponseUsedIn
- type Route
- type RoutePathItem
- type Router
- type RouterPathItem
- type RouterPathItemOperation
- type Schema
- func (s Schema) Base() Schema
- func (s Schema) BaseSchemaType() InternalSchemaType
- func (s Schema) CopyBase() Schema
- func (s Schema) FuncTypeName() string
- func (s Schema) IsCustom() bool
- func (s Schema) Kind() SchemaKind
- func (s Schema) ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (s Schema) ParseStrings(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (s Schema) RenderBaseFrom(prefix, from, suffix string) (string, error)
- func (s Schema) RenderBaseGoType() (string, error)
- func (s Schema) RenderConvertToBaseSchema(from string) (string, error)
- func (s Schema) RenderFormat(from string) (string, error)
- func (s Schema) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (s Schema) RenderGoType() (string, error)
- func (s Schema) RenderToBaseType(to, from string) (string, error)
- func (s Schema) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type SchemaComponent
- type SchemaKind
- type SchemaType
- type SliceType
- func (s SliceType) FuncTypeName() string
- func (s SliceType) Kind() SchemaKind
- func (s SliceType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (s SliceType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (s SliceType) RenderFormat(from string) (string, error)
- func (s SliceType) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (s SliceType) RenderGoType() (string, error)
- func (s SliceType) RenderToBaseType(to, from string) (string, error)
- func (s SliceType) RenderUnmarshalJSON(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- type StringRender
- type StringType
- func (s StringType) GoType() string
- func (_ StringType) RenderStringParser(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (_ StringType) RenderToBaseType(from string) (string, error)
- func (_ StringType) RenderToString(from string) (string, error)
- func (_ StringType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type StructureField
- type StructureFieldTag
- type StructureType
- func (s StructureType) FuncTypeName() string
- func (s StructureType) Kind() SchemaKind
- func (s StructureType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (s StructureType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
- func (s StructureType) RenderFormat(from string) (string, error)
- func (s StructureType) RenderFormatStrings(to, from string, isNew bool) (string, error)
- func (s StructureType) RenderGoType() (string, error)
- func (s StructureType) RenderToBaseType(to, from string) (string, error)
- func (s StructureType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
- type TData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewComponents ¶
func NewComponents(spec specification.Components, cfg Config) (zero Components, _ Imports, _ error)
func NewCustomType ¶ added in v0.0.8
func NewCustomType(specCustom string, st InternalSchemaType) (CustomType, Imports)
func NewDateTime ¶ added in v0.1.28
func NewHandler ¶
func NewHandlerHeaderParameter ¶ added in v0.1.0
func NewHandlerHeaderParameter(p *HeaderParameter, cfg Config) (zero HandlerHeaderParameter, _ Imports, _ error)
func NewHandlerParameters ¶ added in v0.1.0
func NewHandlerParameters(p OperationParams, cfg Config) (zero HandlerParameters, _ Imports, _ error)
func NewHandlerPathParameter ¶ added in v0.1.0
func NewHandlerPathParameter(p *PathParameter) (zero HandlerPathParameter, _ Imports, _ error)
func NewHandlerQueryParameter ¶ added in v0.1.0
func NewHandlerQueryParameter(p *QueryParameter, cfg Config) (zero HandlerQueryParameter, _ Imports, _ error)
func NewHeaderParameter ¶ added in v0.0.2
func NewHeaderParameter(sr specification.Ref[specification.HeaderParameter], components Componenter, cfg Config) (zero *HeaderParameter, _ Imports, _ error)
func NewOperation ¶ added in v0.0.2
func NewOperation(s *specification.Operation, components Componenter, cfg Config) (zero *Operation, _ Imports, _ error)
func NewOperationParams ¶ added in v0.0.14
func NewOperationParams(params specification.OperationParameters, components Componenter, cfg Config) (zero OperationParams, _ Imports, _ error)
func NewPathParameter ¶
func NewPathParameter(rs specification.Ref[specification.PathParameter], components Componenter, cfg Config) (zero *PathParameter, _ Imports, _ error)
func NewQueryParameter ¶ added in v0.0.2
func NewQueryParameter(refP specification.Ref[specification.QueryParameter], components Componenter, cfg Config) (zero *QueryParameter, _ Imports, _ error)
func NewResponse ¶
func NewResponse(handlerName OperationName, status string, response *specification.Response, components Componenter, cfg Config) (*Response, Imports, error)
func NewResponseHeader ¶ added in v0.1.0
func NewResponseHeader(name string, ref specification.Ref[specification.Header], components Componenter, cfg Config) (zero ResponseHeader, _ Imports, _ error)
func NewSchema ¶
func NewSchema(s specification.Ref[specification.Schema], components Componenter, cfg Config) (zero Schema, _ Imports, _ error)
func NewStructureField ¶ added in v0.0.11
func NewStructureField(p specification.SchemaProperty, components Componenter, cfg Config) (zero StructureField, _ Imports, _ error)
func NewStructureType ¶ added in v0.0.11
func NewStructureType(s *specification.Schema, components Componenter, cfg Config) (zero StructureType, _ Imports, _ error)
func PrivateFieldName ¶
func PublicFieldName ¶
Types ¶
type BoolType ¶ added in v0.0.10
type BoolType struct{}
func (BoolType) RenderStringParser ¶ added in v0.1.28
func (BoolType) RenderToBaseType ¶ added in v0.1.28
func (BoolType) RenderToString ¶ added in v0.1.28
func (BoolType) RenderUnmarshalJSON ¶ added in v0.1.29
type ClientOperationHeaderTemplate ¶ added in v0.1.19
type ClientOperationQueryTemplate ¶ added in v0.1.19
type ClientOperationTemplate ¶ added in v0.1.19
type ClientOperationTemplate struct { Name OperationName Description string HTTPMethod specification.HTTPMethod Method specification.HTTPMethodTitle PathRaw string PathParams []PathStringBuilder RequestTypeName string ResponseTypeName string Queries []ClientOperationQueryTemplate Headers []ClientOperationHeaderTemplate IsRequestBody bool Responses []ClientResponseTemplate DefaultResponse *ClientResponseTemplate }
func NewClientOperation ¶ added in v0.0.14
func NewClientOperation(o *Operation) ClientOperationTemplate
func (ClientOperationTemplate) Render ¶ added in v0.1.19
func (c ClientOperationTemplate) Render() (string, error)
type ClientResponseHeaderTemplate ¶ added in v0.1.19
type ClientResponseHeaderTemplate struct { Key string Required bool SchemaParseStrings ParserFunc FieldName string }
type ClientResponseTemplate ¶ added in v0.1.19
type ClientResponseTemplate struct { Name string StatusCode string ComponentRefName string Headers []ClientResponseHeaderTemplate ContentJSON bool }
func (ClientResponseTemplate) Render ¶ added in v0.1.19
func (c ClientResponseTemplate) Render() (string, error)
type ClientTemplate ¶ added in v0.1.19
type ClientTemplate struct {
Operations []ClientOperationTemplate
}
func NewClient ¶ added in v0.0.2
func NewClient(s *specification.Spec, ops []*Operation) ClientTemplate
func (ClientTemplate) Render ¶ added in v0.1.19
func (c ClientTemplate) Render() (string, error)
type Componenter ¶ added in v0.1.24
type Componenter interface { GetSchema(string) (*SchemaComponent, bool) AddSchema(string, Schema, Config) *SchemaComponent }
type Components ¶
type Components struct { Schemas []*SchemaComponent Headers []HeaderComponent RequestBodies []RequestBodyComponent Responses []ResponseComponent HasContentJSON bool }
func (*Components) AddSchema ¶ added in v0.1.24
func (c *Components) AddSchema(name string, s Schema, cfg Config) *SchemaComponent
func (Components) GetSchema ¶ added in v0.1.24
func (c Components) GetSchema(key string) (*SchemaComponent, bool)
func (Components) LenToRender ¶ added in v0.1.21
func (c Components) LenToRender() int
func (Components) Render ¶ added in v0.1.0
func (c Components) Render() (string, error)
type Config ¶ added in v0.1.7
type Config struct { Maybe struct { Import string `yaml:"import"` Type string `yaml:"type"` } `yaml:"maybe"` Nullable struct { Import string `yaml:"import"` Type string `yaml:"type"` } `yaml:"nullable"` Cors struct { Enable bool `yaml:"enable"` } `yaml:"cors"` CustomTypes struct { Ignore bool `yaml:"ignore"` } `yaml:"customTypes"` Experimental struct { CustomJSONImplementation bool `yaml:"customJsonImplementation"` } `yaml:"experimental"` }
func LoadConfig ¶ added in v0.1.7
type CookieParameter ¶ added in v0.0.14
type CookieParameter struct {
specification.CookieParameter
}
type CustomType ¶ added in v0.0.5
type CustomType struct { Value string Type InternalSchemaType }
func (CustomType) FuncTypeName ¶ added in v0.1.25
func (c CustomType) FuncTypeName() string
func (CustomType) Kind ¶ added in v0.1.25
func (c CustomType) Kind() SchemaKind
func (CustomType) ParseString ¶ added in v0.1.0
func (c CustomType) ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error)
func (CustomType) ParseStrings ¶ added in v0.1.21
func (c CustomType) ParseStrings(to, from string, isNew bool, mkErr ErrorRender) (string, error)
func (CustomType) RenderConvertToBaseSchema ¶ added in v0.1.26
func (c CustomType) RenderConvertToBaseSchema(from string) (string, error)
func (CustomType) RenderFormat ¶ added in v0.0.11
func (c CustomType) RenderFormat(from string) (string, error)
func (CustomType) RenderFormatStrings ¶ added in v0.1.19
func (c CustomType) RenderFormatStrings(to, from string, isNew bool) (string, error)
func (CustomType) RenderGoType ¶ added in v0.1.26
func (c CustomType) RenderGoType() (string, error)
func (CustomType) RenderToBaseType ¶ added in v0.1.28
func (c CustomType) RenderToBaseType(to, from string) (string, error)
func (CustomType) RenderUnmarshalJSON ¶ added in v0.1.29
func (c CustomType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
type DateTime ¶ added in v0.1.27
func (DateTime) RenderStringParser ¶ added in v0.1.28
func (DateTime) RenderToBaseType ¶ added in v0.1.28
func (DateTime) RenderToString ¶ added in v0.1.28
func (DateTime) RenderUnmarshalJSON ¶ added in v0.1.29
type ErrorRender ¶ added in v0.0.10
type FloatType ¶ added in v0.0.10
type FloatType struct {
BitSize int
}
func (FloatType) RenderStringParser ¶ added in v0.1.28
func (FloatType) RenderToBaseType ¶ added in v0.1.28
func (FloatType) RenderToString ¶ added in v0.1.28
func (FloatType) RenderUnmarshalJSON ¶ added in v0.1.29
type Formatter ¶ added in v0.0.10
type Formatter interface { RenderFormat(from string) (string, error) RenderFormatStrings(to, from string, isNew bool) (string, error) }
Formatter formats 'string' from '<type>'.
type FormatterFunc ¶ added in v0.0.10
func (FormatterFunc) RenderFormat ¶ added in v0.0.10
func (f FormatterFunc) RenderFormat(from string) (string, error)
type GenOption ¶ added in v0.0.2
type GenOption interface {
// contains filtered or unexported methods
}
func PackageName ¶ added in v0.0.2
func SkipDoNotEdit ¶ added in v0.0.2
func SkipDoNotEdit() GenOption
func SpecFilename ¶ added in v0.0.14
type Generator ¶ added in v0.0.2
type Generator struct { Options GeneratorOptions Spec *specification.Spec Imports Imports Operations []*Operation Paths []*PathItem Client ClientTemplate Components *Components Router Router HandlersFile HandlersFileTemplate Handlers []*Handler IsWriteJSONFunc bool }
func NewGenerator ¶ added in v0.0.2
func (*Generator) ClientFile ¶ added in v0.0.2
func (*Generator) ComponentsFile ¶ added in v0.1.0
func (*Generator) HandlerFile ¶ added in v0.1.0
func (*Generator) RouterFile ¶ added in v0.0.2
type GeneratorOptions ¶ added in v0.0.14
type GoTypeRender ¶ added in v0.1.26
type GoTypeRenderFunc ¶ added in v0.1.26
func (GoTypeRenderFunc) Render ¶ added in v0.1.26
func (r GoTypeRenderFunc) Render() (string, error)
type Handler ¶
type Handler struct { *Operation HandlerFuncName string BasePathPrefix string CanParseError bool Parameters HandlerParameters PathParsers []Parser DefaultResponse *HandlerResponse Responses []HandlerResponse }
type HandlerHeaderParameter ¶ added in v0.1.0
type HandlerHeaderParameter struct { HandlerParameter ParameterName string Required bool Parser Parser }
type HandlerParameter ¶ added in v0.1.0
type HandlerParameter struct { FieldName string GoTypeFn GoTypeRenderFunc FieldComment string }
func (HandlerParameter) Render ¶ added in v0.1.0
func (h HandlerParameter) Render() (string, error)
type HandlerParameterHeaderTemplate ¶ added in v0.1.23
type HandlerParameterHeaderTemplate struct { HandlerParameter HandlerParameterTemplate ParameterName string Required bool Parser Parser }
func NewHandlerParameterHeaderTemplate ¶ added in v0.1.23
func NewHandlerParameterHeaderTemplate(p HandlerHeaderParameter) HandlerParameterHeaderTemplate
func NewHandlerParameterHeaderTemplates ¶ added in v0.1.23
func NewHandlerParameterHeaderTemplates(ps []HandlerHeaderParameter) []HandlerParameterHeaderTemplate
type HandlerParameterPathTemplate ¶ added in v0.1.23
type HandlerParameterPathTemplate struct {
HandlerParameter HandlerParameterTemplate
}
func NewHandlerParameterPathTemplate ¶ added in v0.1.23
func NewHandlerParameterPathTemplate(p HandlerPathParameter) HandlerParameterPathTemplate
func NewHandlerParameterPathTemplates ¶ added in v0.1.23
func NewHandlerParameterPathTemplates(ps []HandlerPathParameter) []HandlerParameterPathTemplate
type HandlerParameterQueryTemplate ¶ added in v0.1.23
type HandlerParameterQueryTemplate struct { HandlerParameter HandlerParameterTemplate ParameterName string Required bool ParseStrings func(to, from string, isNew bool, mkErr ErrorRender) (string, error) }
func NewHandlerParameterQueryTemplate ¶ added in v0.1.23
func NewHandlerParameterQueryTemplate(p HandlerQueryParameter) HandlerParameterQueryTemplate
func NewHandlerParameterQueryTemplates ¶ added in v0.1.23
func NewHandlerParameterQueryTemplates(ps []HandlerQueryParameter) []HandlerParameterQueryTemplate
type HandlerParameterTemplate ¶ added in v0.1.23
type HandlerParameterTemplate struct { FieldName string FieldComment string GoTypeFn GoTypeRenderFunc }
func NewHandlerParameterTemplate ¶ added in v0.1.23
func NewHandlerParameterTemplate(h HandlerParameter) HandlerParameterTemplate
func (HandlerParameterTemplate) Render ¶ added in v0.1.23
func (t HandlerParameterTemplate) Render() (string, error)
type HandlerParameters ¶ added in v0.1.0
type HandlerParameters struct { Query []HandlerQueryParameter Path []HandlerPathParameter Header []HandlerHeaderParameter }
type HandlerPathParameter ¶ added in v0.1.0
type HandlerPathParameter struct { HandlerParameter ParameterName string Parser Parser }
type HandlerQueryParameter ¶ added in v0.1.0
type HandlerQueryParameter struct { HandlerParameter ParameterName string Required bool Parser Parser }
type HandlerResponse ¶ added in v0.1.0
type HandlerResponse struct { *Response Name string // PrivateName string HandlerName OperationName Status string IsDefault bool UsedIn []ResponseUsedIn IsBody bool GoTypeFn GoTypeRenderFunc Body *SchemaComponent BodyRenders Renders ContentType string Struct StructureType StructGoTypeFn GoTypeRenderFunc Args []ResponseArg }
func NewHandlerResponse ¶ added in v0.1.0
func NewHandlerResponse(r *Response, name OperationName, status string, components Componenter, cfg Config, ifaceNames ...ResponseUsedIn) HandlerResponse
func (HandlerResponse) Render ¶ added in v0.1.0
func (h HandlerResponse) Render() (string, error)
type HandlerResponseTemplate ¶ added in v0.1.23
type HandlerResponseTemplate struct { Name string Description string HandlerName OperationName Status string IsDefault bool UsedIn []ResponseUsedIn IsBody bool GoTypeFn GoTypeRenderFunc Body *SchemaComponent BodyRenders Renders ContentType string Struct StructureType StructGoTypeFn GoTypeRenderFunc Args []ResponseArg Headers []ResponseHeader IsComponent bool }
func NewHandlerResponseTemplate ¶ added in v0.1.23
func NewHandlerResponseTemplate(r HandlerResponse) HandlerResponseTemplate
func NewHandlerResponseTemplates ¶ added in v0.1.23
func NewHandlerResponseTemplates(rs []HandlerResponse) []HandlerResponseTemplate
func (HandlerResponseTemplate) Render ¶ added in v0.1.23
func (t HandlerResponseTemplate) Render() (string, error)
type HandlerTemplate ¶ added in v0.1.23
type HandlerTemplate struct { Name OperationName Description string Summary string HandlerFuncName string BasePathPrefix string CanParseError bool ParametersQuery []HandlerParameterQueryTemplate ParametersPath []HandlerParameterPathTemplate ParametersHeader []HandlerParameterHeaderTemplate GoTypeFn GoTypeRenderFunc BodyType *SchemaComponent PathParsers []Parser Responses []HandlerResponseTemplate DefaultResponse Maybe[HandlerResponseTemplate] }
func NewHandlerTemplate ¶ added in v0.1.23
func NewHandlerTemplate(h *Handler) HandlerTemplate
func (HandlerTemplate) Render ¶ added in v0.1.23
func (t HandlerTemplate) Render() (string, error)
type HandlersFileTemplate ¶ added in v0.1.23
type HandlersFileTemplate struct { Handlers []HandlerTemplate IsWriteJSONFunc bool IsCustomMaybe bool IsCustomNullable bool }
func NewHandlersFileTemplate ¶ added in v0.1.23
func NewHandlersFileTemplate(hs []*Handler, isWriteJSONFunc bool, cfg Config) HandlersFileTemplate
func (HandlersFileTemplate) Render ¶ added in v0.1.23
func (t HandlersFileTemplate) Render() (string, error)
type HeaderComponent ¶ added in v0.1.2
type HeaderComponent struct { Name string Description string Type SchemaType GoTypeRenderFn GoTypeRenderFunc }
func (HeaderComponent) Render ¶ added in v0.1.2
func (s HeaderComponent) Render() (string, error)
type HeaderParameter ¶ added in v0.0.2
type IntType ¶ added in v0.0.2
type IntType struct {
BitSize int
}
func (IntType) RenderStringParser ¶ added in v0.1.28
func (IntType) RenderToBaseType ¶ added in v0.1.28
func (IntType) RenderToString ¶ added in v0.1.28
func (IntType) RenderUnmarshalJSON ¶ added in v0.1.29
type InternalSchemaType ¶ added in v0.1.28
type InternalSchemaType interface { GoTypeRender Parser Formatter RenderToBaseType(to, from string) (string, error) FuncTypeName() string Kind() SchemaKind RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error) }
type NamedComponenter ¶ added in v0.1.24
type NamedComponenter struct { Componenter Name string }
func (NamedComponenter) AddSchema ¶ added in v0.1.24
func (n NamedComponenter) AddSchema(name string, s Schema, cfg Config) *SchemaComponent
type NullableType ¶ added in v0.1.25
type NullableType struct { V InternalSchemaType TypeName string }
func NewNullableType ¶ added in v0.1.25
func NewNullableType(v InternalSchemaType, cfg Config) NullableType
func (NullableType) FuncTypeName ¶ added in v0.1.25
func (n NullableType) FuncTypeName() string
func (NullableType) GoType ¶ added in v0.1.28
func (n NullableType) GoType(from string) string
func (NullableType) Kind ¶ added in v0.1.25
func (n NullableType) Kind() SchemaKind
func (NullableType) ParseString ¶ added in v0.1.25
func (n NullableType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
func (NullableType) ParseStrings ¶ added in v0.1.25
func (n NullableType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
func (NullableType) RenderBaseFrom ¶ added in v0.1.28
func (n NullableType) RenderBaseFrom(prefix, from, suffix string) (string, error)
func (NullableType) RenderFormat ¶ added in v0.1.25
func (n NullableType) RenderFormat(from string) (string, error)
func (NullableType) RenderFormatStrings ¶ added in v0.1.25
func (n NullableType) RenderFormatStrings(to, from string, isNew bool) (string, error)
func (NullableType) RenderGoType ¶ added in v0.1.26
func (n NullableType) RenderGoType() (string, error)
func (NullableType) RenderToBaseType ¶ added in v0.1.28
func (n NullableType) RenderToBaseType(to, from string) (string, error)
func (NullableType) RenderUnmarshalJSON ¶ added in v0.1.29
func (n NullableType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
type Operation ¶ added in v0.0.2
type Operation struct { *specification.Operation Name OperationName Description string Summary string Path Path PathBuilder []OperationPathElement APIHandlerFieldName string HandlerTypeName string RequestTypeName string ResponseTypeName string Params OperationParams Body struct { GoTypeFn GoTypeRenderFunc Type Maybe[SchemaComponent] } DefaultResponse *ResponseCode Responses []*ResponseCode }
type OperationName ¶ added in v0.0.2
type OperationName string
func NewOperationName ¶ added in v0.0.14
func NewOperationName(method specification.HTTPMethodTitle, s *specification.Operation, path Path) OperationName
type OperationParams ¶ added in v0.0.14
type OperationParams struct { Query specification.Map[*QueryParameter] Headers specification.Map[*HeaderParameter] Path specification.Map[*PathParameter] Cookie specification.Map[*CookieParameter] }
type OperationPathElement ¶ added in v0.1.0
type OperationPathElement struct { Raw string Param Maybe[*PathParameter] }
type OptionalType ¶ added in v0.1.5
type OptionalType struct { V SchemaType MaybeType string }
func NewOptionalType ¶ added in v0.1.5
func NewOptionalType(v SchemaType, cfg Config) OptionalType
func (OptionalType) FuncTypeName ¶ added in v0.1.24
func (p OptionalType) FuncTypeName() string
func (OptionalType) Kind ¶ added in v0.1.24
func (p OptionalType) Kind() SchemaKind
func (OptionalType) ParseString ¶ added in v0.1.5
func (p OptionalType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
func (OptionalType) ParseStrings ¶ added in v0.1.21
func (p OptionalType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
func (OptionalType) RenderBaseFrom ¶ added in v0.1.28
func (p OptionalType) RenderBaseFrom(prefix, from, suffix string) (string, error)
func (OptionalType) RenderConvertToBaseSchema ¶ added in v0.1.27
func (p OptionalType) RenderConvertToBaseSchema(from string) (string, error)
func (OptionalType) RenderFormat ¶ added in v0.1.5
func (p OptionalType) RenderFormat(from string) (string, error)
func (OptionalType) RenderFormatStrings ¶ added in v0.1.21
func (p OptionalType) RenderFormatStrings(to, from string, isNew bool) (string, error)
func (OptionalType) RenderGoType ¶ added in v0.1.26
func (p OptionalType) RenderGoType() (string, error)
func (OptionalType) RenderToBaseType ¶ added in v0.1.28
func (p OptionalType) RenderToBaseType(to, from string) (string, error)
func (OptionalType) RenderUnmarshalJSON ¶ added in v0.1.29
func (p OptionalType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
type Parser ¶ added in v0.0.10
type Parser interface { ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error) ParseStrings(to, from string, isNew bool, mkErr ErrorRender) (string, error) }
Parser parses 'string' to '<type>'.
type ParserFunc ¶ added in v0.0.10
type ParserFunc func(to, from string, isNew bool, mkErr ErrorRender) (string, error)
func (ParserFunc) ParseString ¶ added in v0.1.0
func (p ParserFunc) ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error)
type Path ¶ added in v0.1.19
type Path struct { Raw string Dirs []*PathV Parameters specification.Map[*PathV] }
func (Path) StringBuilder ¶ added in v0.1.21
func (p Path) StringBuilder() []PathStringBuilder
type PathItem ¶
type PathItem struct { *specification.PathItem Operations []*Operation }
type PathParameter ¶
type PathParameters ¶ added in v0.0.2
type PathParameters []*PathParameter
func (PathParameters) Get ¶ added in v0.0.2
func (s PathParameters) Get(name string) (zero *PathParameter, _ error)
type PathParserConstant ¶ added in v0.1.0
func (PathParserConstant) ParseString ¶ added in v0.1.0
func (p PathParserConstant) ParseString(_, _ string, _ bool, _ ErrorRender) (string, error)
func (PathParserConstant) ParseStrings ¶ added in v0.1.21
func (p PathParserConstant) ParseStrings(_, _ string, _ bool, _ ErrorRender) (string, error)
type PathParserVariable ¶ added in v0.1.0
func (PathParserVariable) ParseString ¶ added in v0.1.0
func (p PathParserVariable) ParseString(to, from string, isNew bool, mkErr ErrorRender) (string, error)
func (PathParserVariable) ParseStrings ¶ added in v0.1.21
func (p PathParserVariable) ParseStrings(to, from string, isNew bool, mkErr ErrorRender) (string, error)
type PathStringBuilder ¶ added in v0.1.21
type PathStringBuilder struct { Prefix string Param *PathParameter }
type PathV ¶ added in v0.1.19
type PathV struct { V string IsVariable bool Param *PathParameter }
type Primitive ¶ added in v0.1.24
type Primitive struct {
PrimitiveIface
}
func NewPrimitive ¶ added in v0.1.24
func NewPrimitive(v PrimitiveIface) Primitive
func (Primitive) FuncTypeName ¶ added in v0.1.24
func (Primitive) Kind ¶ added in v0.1.24
func (t Primitive) Kind() SchemaKind
func (Primitive) ParseString ¶ added in v0.1.28
func (Primitive) ParseStrings ¶ added in v0.1.24
func (Primitive) RenderFormat ¶ added in v0.1.28
func (Primitive) RenderFormatStrings ¶ added in v0.1.24
func (Primitive) RenderGoType ¶ added in v0.1.26
func (Primitive) RenderToBaseType ¶ added in v0.1.28
func (Primitive) RenderUnmarshalJSON ¶ added in v0.1.29
type PrimitiveIface ¶ added in v0.1.24
type PrimitiveIface interface { GoType() string RenderToBaseType(from string) (string, error) RenderToString(from string) (string, error) RenderStringParser(to, from string, isNew bool, mkErr ErrorRender) (string, error) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error) }
type QueryParameter ¶ added in v0.0.2
type QueryParameter struct { Name string Description string FieldName string Required bool Type SchemaType }
type RenderFunc ¶ added in v0.0.10
func (RenderFunc) Render ¶ added in v0.0.10
func (r RenderFunc) Render() (string, error)
type RequestBodyComponent ¶ added in v0.1.2
type RequestBodyComponent struct { Name string Description string GoTypeFn GoTypeRenderFunc }
func (RequestBodyComponent) Render ¶ added in v0.1.2
func (s RequestBodyComponent) Render() (string, error)
type Response ¶
type Response struct { *specification.Response Name string Headers []ResponseHeader // Content specification.Map[specification.Ref[SchemaType]] ContentJSON Maybe[ResponseContentSchema] }
type ResponseArg ¶
type ResponseArg struct { FieldName string ArgName string IsHeader bool GoTypeFn GoTypeRenderFunc }
type ResponseCode ¶ added in v0.1.8
type ResponseCode struct { *Response StatusCode string ComponentRef *specification.Object[string, specification.Ref[specification.Response]] }
type ResponseComponent ¶ added in v0.1.8
type ResponseComponent struct { Name string Description string Alias string IsComponent bool HandlerResponse }
func (ResponseComponent) Render ¶ added in v0.1.8
func (c ResponseComponent) Render() (string, error)
type ResponseContentSchema ¶ added in v0.1.24
type ResponseContentSchema struct { Spec specification.Ref[specification.Schema] Type Schema }
type ResponseHeader ¶
type ResponseHeader struct { Spec *specification.Header FieldName string Key string Required bool Schema interface { GoTypeRender Parser } IsCustomType bool }
type ResponseUsedIn ¶ added in v0.1.8
type ResponseUsedIn struct { OperationName OperationName Status string }
type Route ¶
type Route struct { Name string BasePath string Prefix string PrefixPathItems []*RoutePathItem Variable *RoutePathItem Routes []*Route VariableRoute *Route // contains filtered or unexported fields }
func (*Route) Add ¶ added in v0.0.14
func (r *Route) Add(pi *RouterPathItem)
type RoutePathItem ¶ added in v0.0.14
type RoutePathItem struct { *RouterPathItem Prefix string }
type Router ¶
type Router struct { BasePath string SpecFilename string SpecFileExt string PathItems []*RouterPathItem Operations []*Operation Routes []*Route JWT bool APIKeys []string APIKeysQuery []string Cors bool }
func NewRouter ¶
func NewRouter(s *specification.Spec, ps []*PathItem, os []*Operation, opt GeneratorOptions) Router
type RouterPathItem ¶ added in v0.0.14
type RouterPathItem struct { RawPath string Operations []RouterPathItemOperation JWT bool HasOptions bool }
type RouterPathItemOperation ¶ added in v0.1.14
type RouterPathItemOperation struct { Name OperationName Method specification.HTTPMethodTitle PathSpec string Handler string IsCORS bool CORSMethods []string CORSHeaders []string APIKeys []string APIKeysQuery []string }
type Schema ¶ added in v0.0.2
type Schema struct { Description string Ref *SchemaComponent Type InternalSchemaType Nullable string CustomType string }
func NewSchemaRef ¶
func NewSchemaRef(sc *SchemaComponent) Schema
func NewSchemaWithType ¶ added in v0.1.24
func NewSchemaWithType(s InternalSchemaType) Schema
func (Schema) BaseSchemaType ¶ added in v0.1.24
func (s Schema) BaseSchemaType() InternalSchemaType
func (Schema) FuncTypeName ¶ added in v0.1.24
func (Schema) Kind ¶ added in v0.1.24
func (s Schema) Kind() SchemaKind
func (Schema) ParseString ¶ added in v0.1.24
func (Schema) ParseStrings ¶ added in v0.1.24
func (Schema) RenderBaseFrom ¶ added in v0.1.28
func (Schema) RenderBaseGoType ¶ added in v0.1.29
func (Schema) RenderConvertToBaseSchema ¶ added in v0.1.26
func (Schema) RenderFormat ¶ added in v0.1.24
func (Schema) RenderFormatStrings ¶ added in v0.1.24
func (Schema) RenderGoType ¶ added in v0.1.26
func (Schema) RenderToBaseType ¶ added in v0.1.28
func (Schema) RenderUnmarshalJSON ¶ added in v0.1.29
type SchemaComponent ¶ added in v0.0.11
type SchemaComponent struct { Name string Schema Schema Description string IgnoreParseFormat bool // IsAlias bool WriteJSONFunc bool StructureType StructureType BaseType GoTypeRender GoTypeFn GoTypeRenderFunc FuncTypeName string }
func NewSchemaComponent ¶ added in v0.1.24
func NewSchemaComponent(name string, schema Schema, cs Componenter, cfg Config) SchemaComponent
func (SchemaComponent) Render ¶ added in v0.1.0
func (s SchemaComponent) Render() (string, error)
type SchemaKind ¶ added in v0.1.24
type SchemaKind string
const ( SchemaKindPrimitive SchemaKind = "primitive" SchemaKindArray SchemaKind = "array" SchemaKindObject SchemaKind = "object" SchemaKindRef SchemaKind = "ref" )
type SchemaType ¶ added in v0.1.0
type SliceType ¶ added in v0.0.2
type SliceType struct {
Items Schema
}
func (SliceType) FuncTypeName ¶ added in v0.1.24
func (SliceType) Kind ¶ added in v0.1.24
func (s SliceType) Kind() SchemaKind
func (SliceType) ParseString ¶ added in v0.1.0
func (SliceType) ParseStrings ¶ added in v0.1.0
func (SliceType) RenderFormat ¶ added in v0.0.11
func (SliceType) RenderFormatStrings ¶ added in v0.1.21
func (SliceType) RenderGoType ¶ added in v0.1.26
func (SliceType) RenderToBaseType ¶ added in v0.1.28
func (SliceType) RenderUnmarshalJSON ¶ added in v0.1.29
type StringRender ¶ added in v0.0.10
type StringRender string
func (StringRender) Render ¶ added in v0.0.10
func (s StringRender) Render() (string, error)
type StringType ¶
type StringType struct{}
func (StringType) GoType ¶ added in v0.1.24
func (s StringType) GoType() string
func (StringType) RenderStringParser ¶ added in v0.1.28
func (_ StringType) RenderStringParser(to, from string, isNew bool, mkErr ErrorRender) (string, error)
func (StringType) RenderToBaseType ¶ added in v0.1.28
func (_ StringType) RenderToBaseType(from string) (string, error)
func (StringType) RenderToString ¶ added in v0.1.28
func (_ StringType) RenderToString(from string) (string, error)
func (StringType) RenderUnmarshalJSON ¶ added in v0.1.29
func (_ StringType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
type StructureField ¶ added in v0.0.11
type StructureField struct { Comment string Name string GoTypeFn GoTypeRenderFunc Type SchemaType Schema Schema Tags []StructureFieldTag JSONTag string Embedded bool Required bool RenderToBaseTypeFn func(to, from string) (string, error) }
func (StructureField) GetTag ¶ added in v0.1.0
func (sf StructureField) GetTag(k string) (zero StructureFieldTag, _ bool)
func (StructureField) Render ¶ added in v0.1.0
func (s StructureField) Render() (string, error)
type StructureFieldTag ¶ added in v0.0.11
type StructureType ¶ added in v0.0.11
type StructureType struct { Fields []StructureField AdditionalProperties *GoTypeRender }
func (StructureType) FuncTypeName ¶ added in v0.1.24
func (s StructureType) FuncTypeName() string
func (StructureType) Kind ¶ added in v0.1.24
func (s StructureType) Kind() SchemaKind
func (StructureType) ParseString ¶ added in v0.1.0
func (s StructureType) ParseString(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
func (StructureType) ParseStrings ¶ added in v0.1.21
func (s StructureType) ParseStrings(to string, from string, isNew bool, mkErr ErrorRender) (string, error)
func (StructureType) RenderFormat ¶ added in v0.1.0
func (s StructureType) RenderFormat(from string) (string, error)
func (StructureType) RenderFormatStrings ¶ added in v0.1.21
func (s StructureType) RenderFormatStrings(to, from string, isNew bool) (string, error)
func (StructureType) RenderGoType ¶ added in v0.1.26
func (s StructureType) RenderGoType() (string, error)
func (StructureType) RenderToBaseType ¶ added in v0.1.28
func (s StructureType) RenderToBaseType(to, from string) (string, error)
func (StructureType) RenderUnmarshalJSON ¶ added in v0.1.29
func (s StructureType) RenderUnmarshalJSON(to, from string, isNew bool, mkErr ErrorRender) (string, error)
Click to show internal directories.
Click to hide internal directories.