Documentation
¶
Index ¶
- Variables
- func AddDefaultGoTemplates(to map[string]TemplateAndCondition, includeMocks bool)
- func GenerateTypes(dir, localPrefix string, extraUrls []string, helpers []WorkflowHelperGenerator) error
- func GenerateUserTypes(info UserGenerationInfo) error
- func TypesFromJSONSchema(schemaFilePath string, cfgInfo ConfigInfo) (outputFilePath, outputContents string, err error)
- type BaseGenerate
- type ConfigInfo
- type Field
- type GeneratedInfo
- type GoStructReader
- type Struct
- type TemplateAndCondition
- type TemplateWorkflowGeneratorHelper
- type TestHelperGenerate
- type TypeInfo
- type UserGenerationInfo
- type WorkflowHelperGenerator
Constants ¶
This section is empty.
Variables ¶
View Source
var CapabilitySchemaFilePattern = regexp.MustCompile(`([^/]+)_(action|trigger|consensus|target|common)-schema\.json$`)
CapabilitySchemaFilePattern is used to extract the package name from the file path. This is used as the package name for the generated Go types.
Functions ¶
func AddDefaultGoTemplates ¶ added in v0.4.0
func AddDefaultGoTemplates(to map[string]TemplateAndCondition, includeMocks bool)
func GenerateTypes ¶
func GenerateTypes(dir, localPrefix string, extraUrls []string, helpers []WorkflowHelperGenerator) error
func GenerateUserTypes ¶ added in v0.4.0
func GenerateUserTypes(info UserGenerationInfo) error
func TypesFromJSONSchema ¶
func TypesFromJSONSchema(schemaFilePath string, cfgInfo ConfigInfo) (outputFilePath, outputContents string, err error)
TypesFromJSONSchema generates Go types from a JSON schema file.
Types ¶
type BaseGenerate ¶
type BaseGenerate struct {
TemplateValue string
}
func (BaseGenerate) ShouldGenerate ¶
func (a BaseGenerate) ShouldGenerate(GeneratedInfo) bool
func (BaseGenerate) Template ¶
func (a BaseGenerate) Template() string
type ConfigInfo ¶
func ConfigFromSchemas ¶
func ConfigFromSchemas(schemaFilePaths []string) (ConfigInfo, error)
type GeneratedInfo ¶
type GeneratedInfo struct {
Package string
Config Struct
Input *Struct
Types map[string]Struct
CapabilityType capabilities.CapabilityType
BaseName string
RootOutput string
RootNumSlice int
ExtraImports []string
ID *string
FullPackage string
}
func (GeneratedInfo) RootType ¶
func (g GeneratedInfo) RootType() Struct
type GoStructReader ¶ added in v0.4.0
type TemplateAndCondition ¶
type TemplateAndCondition interface {
Template() string
ShouldGenerate(info GeneratedInfo) bool
}
type TemplateWorkflowGeneratorHelper ¶
type TemplateWorkflowGeneratorHelper struct {
Templates map[string]TemplateAndCondition
}
func (*TemplateWorkflowGeneratorHelper) Generate ¶
func (t *TemplateWorkflowGeneratorHelper) Generate(info GeneratedInfo) (map[string]string, error)
type TestHelperGenerate ¶
type TestHelperGenerate struct {
TemplateValue string
}
func (TestHelperGenerate) ShouldGenerate ¶
func (a TestHelperGenerate) ShouldGenerate(info GeneratedInfo) bool
func (TestHelperGenerate) Template ¶
func (a TestHelperGenerate) Template() string
type TypeInfo ¶
type TypeInfo struct {
CapabilityType capabilities.CapabilityType
RootType string
SchemaID string
SchemaOutputFile string
}
type UserGenerationInfo ¶ added in v0.4.0
type UserGenerationInfo struct {
Dir string
LocalPrefix string
Helpers []WorkflowHelperGenerator
GenForStruct func(string) bool
}
type WorkflowHelperGenerator ¶
type WorkflowHelperGenerator interface {
Generate(info GeneratedInfo) (map[string]string, error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.