Documentation
¶
Index ¶
- Constants
- Variables
- func AddTemplates(tmpl *template.Template) (*template.Template, error)
- func Clean(raw string) string
- func DefaultSchemaTemplate() (*template.Template, error)
- func IsAllOf(obj interface{}) bool
- func IsAnyOf(obj interface{}) bool
- func IsArray(obj interface{}) bool
- func IsBoolean(obj interface{}) bool
- func IsConst(obj interface{}) bool
- func IsEnum(obj interface{}) bool
- func IsInteger(obj interface{}) bool
- func IsInterface(obj interface{}) bool
- func IsMethod(obj interface{}) bool
- func IsNumber(obj interface{}) bool
- func IsOneOf(obj interface{}) bool
- func IsReference(obj interface{}) bool
- func IsString(obj interface{}) bool
- func IsStruct(obj interface{}) bool
- func IsType(obj interface{}) bool
- func MethodUnmarshalJSON(receiver string, references []*Reference) (*parser.Method, error)
- func MixedCase(raw string) string
- func Typename(raw string) string
- type AllOf
- type AnyOf
- type Array
- type Boolean
- type Const
- type ConstItem
- type Document
- type Enum
- type Integer
- type Interface
- type List
- type Number
- type OneOf
- type Reference
- type String
- type Struct
- func (s *Struct) Comment() string
- func (s *Struct) FieldTag() string
- func (s *Struct) Name() string
- func (s *Struct) UnmarshalStructJSON() *parser.Method
- func (s *Struct) WithFieldTag(tags string) parser.Field
- func (s *Struct) WithMethods(methods ...*parser.Method)
- func (s *Struct) WithReference(ref bool) parser.Field
- type Test
- type Type
Constants ¶
View Source
const AllOfTemplate = `
{{- define "allof" -}}
{{template "kind" .Reference }}
{{- end -}}`
View Source
const AnyOfTemplate = `
{{- define "anyof" -}}
{{template "kind" .Reference }}
{{- end -}}`
View Source
const ArrayTemplate = `` /* 131-byte string literal not displayed */
View Source
const BooleanTemplate = `` /* 139-byte string literal not displayed */
View Source
const ConstTemplate = `` /* 197-byte string literal not displayed */
View Source
const DocumentTemplate = `` /* 307-byte string literal not displayed */
View Source
const EnumTemplate = `` /* 225-byte string literal not displayed */
View Source
const IntegerTemplate = `` /* 140-byte string literal not displayed */
View Source
const InterfaceTemplate = `` /* 335-byte string literal not displayed */
View Source
const KindTemplate = `` /* 992-byte string literal not displayed */
View Source
const NumberTemplate = `` /* 141-byte string literal not displayed */
View Source
const OneOfTemplate = `
{{- define "oneof" -}}
{{template "kind" .Reference }}
{{- end -}}`
View Source
const ReferenceTemplate = `` /* 238-byte string literal not displayed */
View Source
const StringTemplate = `` /* 142-byte string literal not displayed */
View Source
const StructTemplate = `` /* 291-byte string literal not displayed */
View Source
const TypeTemplate = `` /* 303-byte string literal not displayed */
View Source
const UnmarshalJSONBodyTemplate = `` /* 933-byte string literal not displayed */
Variables ¶
View Source
var SchemaFuncMap = template.FuncMap{ "mixedCase": MixedCase, "typename": Typename, "clean": Clean, "title": strings.Title, "isStruct": IsStruct, "isArray": IsArray, "isString": IsString, "isNumber": IsNumber, "isInteger": IsInteger, "isInterface": IsInterface, "isBoolean": IsBoolean, "isReference": IsReference, "isEnum": IsEnum, "isConst": IsConst, "isMethod": IsMethod, "isAllOf": IsAllOf, "isAnyOf": IsAnyOf, "isOneOf": IsOneOf, "isType": IsType, }
View Source
var TemplateArray = []string{ StructTemplate, ArrayTemplate, NumberTemplate, IntegerTemplate, StringTemplate, BooleanTemplate, InterfaceTemplate, EnumTemplate, ReferenceTemplate, KindTemplate, ConstTemplate, parser.MethodTemplate, AllOfTemplate, AnyOfTemplate, OneOfTemplate, parser.MethodSignatureTemplate, TypeTemplate, }
Functions ¶
func DefaultSchemaTemplate ¶
func IsInterface ¶
func IsInterface(obj interface{}) bool
func IsReference ¶
func IsReference(obj interface{}) bool
func MethodUnmarshalJSON ¶
Types ¶
type Boolean ¶
type Boolean struct {
Reference string
// contains filtered or unexported fields
}
func NewBoolean ¶
type Document ¶
type Document struct {
ID string
Package string
Imports []string
// contains filtered or unexported fields
}
func NewDocument ¶
func NewDocument(packagename string, schema *jsonschema.Schema) *Document
func (*Document) WithPackageName ¶
type Enum ¶
type Enum struct {
Type string
Values []string
Reference string
Items []*ConstItem
Methods []*parser.Method
// contains filtered or unexported fields
}
func (*Enum) WithMethods ¶
type Integer ¶
type Integer struct {
Reference string
// contains filtered or unexported fields
}
func NewInteger ¶
type Interface ¶
type Interface struct {
CommentImplementations string
MethodSignatures []*parser.MethodSignature
// contains filtered or unexported fields
}
func NewInterface ¶
func (*Interface) WithMethodSignature ¶
func (s *Interface) WithMethodSignature(methodSignature ...*parser.MethodSignature) *Interface
type Reference ¶
type Reference struct {
Types []string
Type *parser.Type
Reference string
// contains filtered or unexported fields
}
func NewReference ¶
type Struct ¶
type Struct struct {
Fields []parser.Component
Reference string
Methods []*parser.Method
// contains filtered or unexported fields
}
func (*Struct) UnmarshalStructJSON ¶
func (*Struct) WithMethods ¶
Click to show internal directories.
Click to hide internal directories.