Documentation
¶
Index ¶
- func JSONBase() []byte
- func JSONSub() []byte
- func JSONSub2() []byte
- func JSONSub3() []byte
- func JSONUnnamedNestedObject() []byte
- func JSONsetId(jsp JSONDict, p Property)
- func JSONsetOptionalBoolean(js JSONDict, key string, value rusty.Optional[bool])
- func JSONsetOptionalFloat64(js JSONDict, key string, value rusty.Optional[float64])
- func JSONsetOptionalInt(js JSONDict, key string, value rusty.Optional[int])
- func JSONsetOptionalString(js JSONDict, key string, value rusty.Optional[string])
- func JSONsetString(js JSONDict, key string, value string)
- func JSONsetXProperties(js JSONDict, value map[string]interface{})
- func NewPropertyArray(p PropertyArrayBuilder) rusty.Result[Property]
- func NewPropertyArrayItem(name string, property rusty.Result[Property], optionals ...bool) rusty.Result[PropertyItem]
- func NewPropertyBoolean(p PropertyBooleanBuilder) rusty.Result[Property]
- func NewPropertyInteger(p PropertyIntegerBuilder) rusty.Result[Property]
- func NewPropertyNumber(p PropertyNumberBuilder) rusty.Result[Property]
- func NewPropertyObject(p PropertyObjectBuilder) rusty.Result[Property]
- func NewPropertyObjectItem(name string, property rusty.Result[Property], idx int, optionals ...bool) rusty.Result[PropertyItem]
- func NewPropertyString(p PropertyStringBuilder) rusty.Result[Property]
- func TestFlatSchema(sl PropertyCtx) rusty.Result[Property]
- func TestPayloadSchema(sl PropertyCtx) rusty.Result[Property]
- func WriteTestSchema(cfg *GeneratorConfig) string
- type BufLineWriter
- type Config
- type ForIfWhileLangWriter
- func (w *ForIfWhileLangWriter) FormatLine(format string, args ...interface{}) string
- func (w *ForIfWhileLangWriter) Indent() *ForIfWhileLangWriter
- func (w *ForIfWhileLangWriter) Lines() []string
- func (w *ForIfWhileLangWriter) WriteBlock(keyword, expression string, fn func(wr *ForIfWhileLangWriter), opts ...string) string
- func (w *ForIfWhileLangWriter) WriteIf(expression string, fnTrue func(wr *ForIfWhileLangWriter), ...)
- func (w *ForIfWhileLangWriter) WriteLine(lines ...string)
- type GeneratorConfig
- type JSONDict
- func NewJSONDict() JSONDict
- func PropertyArrayToJson(b PropertyArray) JSONDict
- func PropertyBooleanToJson(b PropertyBoolean) JSONDict
- func PropertyIntegerToJson(b PropertyInteger) JSONDict
- func PropertyNumberToJson(b PropertyNumber) JSONDict
- func PropertyObjectToJson(b PropertyObject) JSONDict
- func PropertyStringToJson(b PropertyString) JSONDict
- func PropertyToJson(iprop Property) JSONDict
- type JSonFile
- type PropertiesBuilder
- func (b *PropertiesBuilder) Build() rusty.Result[Property]
- func (b *PropertiesBuilder) FileName() rusty.Optional[string]
- func (b *PropertiesBuilder) FromJson(js JSONDict) *PropertiesBuilder
- func (b *PropertiesBuilder) MergeJson(parentFname rusty.Optional[string], ref string, js JSONDict) rusty.Result[JSonFile]
- type Property
- type PropertyArray
- type PropertyArrayBuilder
- type PropertyBoolean
- type PropertyBooleanBuilder
- type PropertyBuilder
- type PropertyCtx
- type PropertyFormat
- type PropertyInteger
- type PropertyIntegerBuilder
- type PropertyItem
- type PropertyMeta
- type PropertyNumber
- type PropertyNumberBuilder
- type PropertyObject
- type PropertyObjectBuilder
- type PropertyString
- type PropertyStringBuilder
- type SchemaLoader
- type SchemaLoaderImpl
- func (sl SchemaLoaderImpl) Abs(fname string) (string, error)
- func (sl SchemaLoaderImpl) Clone(prependIncDirs ...string) SchemaLoader
- func (sl SchemaLoaderImpl) IncludeDirs() []string
- func (sl SchemaLoaderImpl) ReadFile(fname string) ([]byte, error)
- func (SchemaLoaderImpl) Unmarshal(bytes []byte, v interface{}) error
- type SchemaRegistry
- type SchemaRegistryItem
- type StringFormat
- type TestSchemaLoader
- func (l *TestSchemaLoader) Abs(path string) (string, error)
- func (sl TestSchemaLoader) Clone(prependIncDirs ...string) SchemaLoader
- func (t *TestSchemaLoader) IncludeDirs() []string
- func (l *TestSchemaLoader) ReadFile(path string) ([]byte, error)
- func (l *TestSchemaLoader) Unmarshal(bytes []byte, v interface{}) error
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONUnnamedNestedObject ¶ added in v1.0.11
func JSONUnnamedNestedObject() []byte
func JSONsetOptionalBoolean ¶ added in v1.0.10
func JSONsetOptionalFloat64 ¶ added in v1.0.10
func JSONsetOptionalInt ¶ added in v1.0.10
func JSONsetOptionalString ¶ added in v1.0.10
func JSONsetString ¶ added in v1.0.10
func JSONsetXProperties ¶ added in v1.0.34
func NewPropertyArray ¶
func NewPropertyArray(p PropertyArrayBuilder) rusty.Result[Property]
func NewPropertyArrayItem ¶ added in v1.0.14
func NewPropertyBoolean ¶
func NewPropertyBoolean(p PropertyBooleanBuilder) rusty.Result[Property]
func NewPropertyInteger ¶
func NewPropertyInteger(p PropertyIntegerBuilder) rusty.Result[Property]
func NewPropertyNumber ¶
func NewPropertyNumber(p PropertyNumberBuilder) rusty.Result[Property]
func NewPropertyObject ¶
func NewPropertyObject(p PropertyObjectBuilder) rusty.Result[Property]
func NewPropertyObjectItem ¶ added in v1.0.14
func NewPropertyString ¶
func NewPropertyString(p PropertyStringBuilder) rusty.Result[Property]
func TestFlatSchema ¶
func TestFlatSchema(sl PropertyCtx) rusty.Result[Property]
func TestPayloadSchema ¶ added in v1.0.13
func TestPayloadSchema(sl PropertyCtx) rusty.Result[Property]
func WriteTestSchema ¶
func WriteTestSchema(cfg *GeneratorConfig) string
Types ¶
type BufLineWriter ¶
type BufLineWriter struct {
Lines []string
}
type ForIfWhileLangWriter ¶
type ForIfWhileLangWriter struct {
OfsIndent string
// contains filtered or unexported fields
}
func NewForIfWhileLangWriter ¶
func NewForIfWhileLangWriter(f ForIfWhileLangWriter) *ForIfWhileLangWriter
func (*ForIfWhileLangWriter) FormatLine ¶
func (w *ForIfWhileLangWriter) FormatLine(format string, args ...interface{}) string
func (*ForIfWhileLangWriter) Indent ¶
func (w *ForIfWhileLangWriter) Indent() *ForIfWhileLangWriter
func (*ForIfWhileLangWriter) Lines ¶
func (w *ForIfWhileLangWriter) Lines() []string
func (*ForIfWhileLangWriter) WriteBlock ¶
func (w *ForIfWhileLangWriter) WriteBlock(keyword, expression string, fn func(wr *ForIfWhileLangWriter), opts ...string) string
func (*ForIfWhileLangWriter) WriteIf ¶
func (w *ForIfWhileLangWriter) WriteIf(expression string, fnTrue func(wr *ForIfWhileLangWriter), fnFalses ...func(wr *ForIfWhileLangWriter))
func (*ForIfWhileLangWriter) WriteLine ¶
func (w *ForIfWhileLangWriter) WriteLine(lines ...string)
type GeneratorConfig ¶
type JSONDict ¶ added in v1.0.16
type JSONDict interface {
// orderedmap.OrderedMap
Set(key string, value any)
Get(key string) any
Keys() []string
Len() int
Lookup(key string) (any, bool)
UnmarshalJSON([]byte) error
MarshalJSON() ([]byte, error)
}
type JSONDict map[string]interface{}
func NewJSONDict ¶ added in v1.0.16
func NewJSONDict() JSONDict
func PropertyArrayToJson ¶ added in v1.0.10
func PropertyArrayToJson(b PropertyArray) JSONDict
func PropertyBooleanToJson ¶ added in v1.0.10
func PropertyBooleanToJson(b PropertyBoolean) JSONDict
func PropertyIntegerToJson ¶ added in v1.0.10
func PropertyIntegerToJson(b PropertyInteger) JSONDict
func PropertyNumberToJson ¶ added in v1.0.10
func PropertyNumberToJson(b PropertyNumber) JSONDict
func PropertyObjectToJson ¶ added in v1.0.10
func PropertyObjectToJson(b PropertyObject) JSONDict
func PropertyStringToJson ¶ added in v1.0.10
func PropertyStringToJson(b PropertyString) JSONDict
func PropertyToJson ¶ added in v1.0.10
type JSonFile ¶ added in v1.0.14
type JSonFile struct {
FileName string `json:"filename"`
JSONProperty JSONDict `json:"jsonProperty"`
}
func BaseSchema ¶
func BaseSchema() JSonFile
func Sub2Schema ¶
func Sub2Schema() JSonFile
func Sub3Schema ¶ added in v1.0.10
func Sub3Schema() JSonFile
func TestJSONPayloadSchema ¶ added in v1.0.13
func TestJSONPayloadSchema() JSonFile
func TestJSONSchema ¶ added in v1.0.14
func TestJSONSchema() JSonFile
func TestJsonFlatSchema ¶
func TestJsonFlatSchema() JSonFile
func TestJsonSubSchema ¶ added in v1.0.10
func TestJsonSubSchema() JSonFile
func UnnamedNestedObject ¶ added in v1.0.11
func UnnamedNestedObject() JSonFile
type PropertiesBuilder ¶
type PropertiesBuilder struct {
// contains filtered or unexported fields
}
func NewPropertiesBuilder ¶
func NewPropertiesBuilder(run PropertyCtx) *PropertiesBuilder
func (*PropertiesBuilder) FileName ¶ added in v1.0.10
func (b *PropertiesBuilder) FileName() rusty.Optional[string]
func (*PropertiesBuilder) FromJson ¶
func (b *PropertiesBuilder) FromJson(js JSONDict) *PropertiesBuilder
type Property ¶
type Property interface {
Id() string
Type() Type
Description() rusty.Optional[string]
Ref() rusty.Optional[string]
XProperties() map[string]interface{}
Meta() PropertyMeta
}
func NewProperty ¶
func NewProperty(p PropertyBuilder) Property
func TestSchema ¶
func TestSchema(sl PropertyCtx) Property
type PropertyArray ¶
type PropertyArray interface {
Id() string
Type() Type
Description() rusty.Optional[string]
XProperties() map[string]interface{}
// Format() rusty.Optional[string]
// Optional() bool
// SetOptional()
MinItems() rusty.Optional[int]
MaxItems() rusty.Optional[int]
Items() Property
// UniqueItems() bool
// Containts() Property
// AdditionalItems() rusty.Optional[Property]
Ref() rusty.Optional[string]
// ToPropertyObject() rusty.Result[PropertyObject]
Meta() PropertyMeta
}
type PropertyArrayBuilder ¶ added in v1.0.14
type PropertyArrayBuilder struct {
// __loader SchemaLoader
Id string
Type Type
Ref rusty.Optional[string]
Description rusty.Optional[string]
XProperties map[string]interface{}
// Format rusty.Optional[string]
// Optional bool
MinItems rusty.Optional[int]
MaxItems rusty.Optional[int]
Items rusty.Result[Property]
// contains filtered or unexported fields
}
func NewPropertyArrayBuilder ¶ added in v1.0.14
func NewPropertyArrayBuilder(pb *PropertiesBuilder) *PropertyArrayBuilder
func (*PropertyArrayBuilder) Build ¶ added in v1.0.14
func (b *PropertyArrayBuilder) Build() rusty.Result[Property]
func (*PropertyArrayBuilder) FromJson ¶ added in v1.0.14
func (b *PropertyArrayBuilder) FromJson(js JSONDict) *PropertyArrayBuilder
type PropertyBoolean ¶
type PropertyBooleanBuilder ¶ added in v1.0.14
type PropertyBooleanBuilder struct {
Id string
Type Type
XProperties map[string]interface{}
Description rusty.Optional[string]
Default rusty.Optional[bool]
Ref rusty.Optional[string]
}
func NewPropertyBooleanBuilder ¶ added in v1.0.14
func NewPropertyBooleanBuilder(pb *PropertiesBuilder) *PropertyBooleanBuilder
func (*PropertyBooleanBuilder) Build ¶ added in v1.0.14
func (b *PropertyBooleanBuilder) Build() rusty.Result[Property]
func (*PropertyBooleanBuilder) FromJson ¶ added in v1.0.14
func (b *PropertyBooleanBuilder) FromJson(js JSONDict) *PropertyBooleanBuilder
type PropertyBuilder ¶ added in v1.0.14
type PropertyCtx ¶ added in v1.0.10
type PropertyCtx struct {
Registry *SchemaRegistry
}
func NewTestContext ¶ added in v1.0.10
func NewTestContext() PropertyCtx
type PropertyFormat ¶ added in v1.0.34
type PropertyInteger ¶
type PropertyInteger interface {
Id() string
Type() Type
Description() rusty.Optional[string]
Format() rusty.Optional[string]
XProperties() map[string]interface{}
// Optional() bool
// SetOptional()
Default() rusty.Optional[int] // match Type
// Enum() []T
Maximum() rusty.Optional[int]
Minimum() rusty.Optional[int]
Ref() rusty.Optional[string]
Meta() PropertyMeta
}
type PropertyIntegerBuilder ¶ added in v1.0.14
type PropertyIntegerBuilder struct {
// __loader SchemaLoader
Id string
Type Type
Ref rusty.Optional[string]
Description rusty.Optional[string]
Format rusty.Optional[string]
Default rusty.Optional[int]
XProperties map[string]interface{}
// Enum []T
// Default rusty.Optional[T]
Maximum rusty.Optional[int]
Minimum rusty.Optional[int]
}
func NewPropertyIntegerBuilder ¶ added in v1.0.14
func NewPropertyIntegerBuilder(pb *PropertiesBuilder) *PropertyIntegerBuilder
func (*PropertyIntegerBuilder) Build ¶ added in v1.0.14
func (b *PropertyIntegerBuilder) Build() rusty.Result[Property]
func (*PropertyIntegerBuilder) FromJson ¶ added in v1.0.14
func (b *PropertyIntegerBuilder) FromJson(js JSONDict) *PropertyIntegerBuilder
type PropertyItem ¶
type PropertyMeta ¶ added in v1.0.14
type PropertyMeta interface {
Parent() rusty.Optional[Property]
SetParent(p Property) PropertyMeta
FileName() rusty.Optional[string]
SetFileName(fn string) PropertyMeta
SetMeta(m Property) PropertyMeta
}
func NewPropertyMeta ¶ added in v1.0.14
func NewPropertyMeta() PropertyMeta
type PropertyNumber ¶
type PropertyNumber interface {
Id() string
Type() Type
Ref() rusty.Optional[string]
Description() rusty.Optional[string]
Format() rusty.Optional[string]
XProperties() map[string]interface{}
Default() rusty.Optional[float64] // match Type
// Enum() []float64
Maximum() rusty.Optional[float64]
Minimum() rusty.Optional[float64]
Meta() PropertyMeta
}
type PropertyNumberBuilder ¶ added in v1.0.14
type PropertyNumberBuilder struct {
// __loader SchemaLoader
Id string
Ref rusty.Optional[string]
Type Type
Description rusty.Optional[string]
Format rusty.Optional[string]
Default rusty.Optional[float64]
XProperties map[string]interface{}
// Enum []float64
Maximum rusty.Optional[float64]
Minimum rusty.Optional[float64]
}
func NewPropertyNumberBuilder ¶ added in v1.0.14
func NewPropertyNumberBuilder(pb *PropertiesBuilder) *PropertyNumberBuilder
func (*PropertyNumberBuilder) Build ¶ added in v1.0.14
func (b *PropertyNumberBuilder) Build() rusty.Result[Property]
func (*PropertyNumberBuilder) FromJson ¶ added in v1.0.14
func (b *PropertyNumberBuilder) FromJson(js JSONDict) *PropertyNumberBuilder
type PropertyObject ¶
type PropertyObject interface {
Type() Type
Id() string
Title() string
Schema() string
Description() rusty.Optional[string]
XProperties() map[string]interface{}
Properties() *properties
Items() []PropertyItem
PropertyByName(name string) rusty.Result[PropertyItem]
Required() []string
Ref() rusty.Optional[string]
Meta() PropertyMeta
}
type PropertyObjectBuilder ¶ added in v1.0.14
type PropertyObjectBuilder struct {
// items []PropertyItem
Type Type
Description rusty.Optional[string]
Id string
Title string
Schema string
Properties *properties // PropertiesObject
Required []string
Ref rusty.Optional[string]
XProperties map[string]interface{}
// Runtime PropertyRuntime
// Ctx PropertyCtx
Errors []error
// contains filtered or unexported fields
}
func NewPropertyObjectBuilder ¶ added in v1.0.14
func NewPropertyObjectBuilder(pb *PropertiesBuilder) *PropertyObjectBuilder
func (*PropertyObjectBuilder) Build ¶ added in v1.0.14
func (p *PropertyObjectBuilder) Build() rusty.Result[Property]
func (*PropertyObjectBuilder) FromJson ¶ added in v1.0.14
func (b *PropertyObjectBuilder) FromJson(js JSONDict) *PropertyObjectBuilder
type PropertyString ¶
type PropertyStringBuilder ¶ added in v1.0.14
type PropertyStringBuilder struct {
// PropertyParam
Id string
Type Type
Description rusty.Optional[string]
Default rusty.Optional[string]
Ref rusty.Optional[string]
XProperties map[string]interface{}
Format rusty.Optional[StringFormat]
}
func NewPropertyStringBuilder ¶ added in v1.0.14
func NewPropertyStringBuilder(pb *PropertiesBuilder) *PropertyStringBuilder
func (*PropertyStringBuilder) Build ¶ added in v1.0.14
func (b *PropertyStringBuilder) Build() rusty.Result[Property]
func (*PropertyStringBuilder) FromJson ¶ added in v1.0.14
func (b *PropertyStringBuilder) FromJson(js JSONDict) *PropertyStringBuilder
type SchemaLoader ¶
type SchemaLoaderImpl ¶ added in v1.0.31
type SchemaLoaderImpl struct {
// contains filtered or unexported fields
}
func NewSchemaLoaderImpl ¶ added in v1.0.31
func NewSchemaLoaderImpl(includeDirs ...string) SchemaLoaderImpl
func (SchemaLoaderImpl) Abs ¶ added in v1.0.31
func (sl SchemaLoaderImpl) Abs(fname string) (string, error)
Abs implements SchemaLoader.
func (SchemaLoaderImpl) Clone ¶ added in v1.0.32
func (sl SchemaLoaderImpl) Clone(prependIncDirs ...string) SchemaLoader
func (SchemaLoaderImpl) IncludeDirs ¶ added in v1.0.32
func (sl SchemaLoaderImpl) IncludeDirs() []string
func (SchemaLoaderImpl) ReadFile ¶ added in v1.0.31
func (sl SchemaLoaderImpl) ReadFile(fname string) ([]byte, error)
ReadFile implements SchemaLoader.
func (SchemaLoaderImpl) Unmarshal ¶ added in v1.0.31
func (SchemaLoaderImpl) Unmarshal(bytes []byte, v interface{}) error
Unmarshal implements SchemaLoader.
type SchemaRegistry ¶
type SchemaRegistry struct {
BaseDir rusty.Optional[string]
// contains filtered or unexported fields
}
func NewSchemaRegistry ¶
func NewSchemaRegistry(loaders ...SchemaLoader) *SchemaRegistry
func (*SchemaRegistry) EnsureJSONProperty ¶ added in v1.0.14
func (*SchemaRegistry) Items ¶
func (sr *SchemaRegistry) Items() []SchemaRegistryItem
type SchemaRegistryItem ¶
type StringFormat ¶
type StringFormat = string
const ( DATE_TIME StringFormat = "date-time" TIME StringFormat = "time" DATE StringFormat = "date" )
type TestSchemaLoader ¶
type TestSchemaLoader struct {
// contains filtered or unexported fields
}
func NewTestSchemaLoader ¶
func NewTestSchemaLoader() *TestSchemaLoader
func (TestSchemaLoader) Clone ¶ added in v1.0.32
func (sl TestSchemaLoader) Clone(prependIncDirs ...string) SchemaLoader
func (*TestSchemaLoader) IncludeDirs ¶ added in v1.0.32
func (t *TestSchemaLoader) IncludeDirs() []string
func (*TestSchemaLoader) ReadFile ¶
func (l *TestSchemaLoader) ReadFile(path string) ([]byte, error)
ReadFile implements SchemaLoader.
func (*TestSchemaLoader) Unmarshal ¶
func (l *TestSchemaLoader) Unmarshal(bytes []byte, v interface{}) error
Unmarshal implements SchemaLoader.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.