cmd

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

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.1.1

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.1.1

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

type ConfigInfo struct {
	generator.Config
	SchemaToTypeInfo map[string]TypeInfo
}

func ConfigFromSchemas

func ConfigFromSchemas(schemaFilePaths []string) (ConfigInfo, error)

type Field

type Field struct {
	Type        string
	NumSlice    int
	IsPrimitive bool
	ConfigName  string
	SkipCap     bool
}

func (Field) WrapCap added in v0.1.1

func (f Field) WrapCap() bool

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.1.1

type GoStructReader struct {
	IncludeType func(name string) bool
}

func (*GoStructReader) Read added in v0.1.1

func (g *GoStructReader) Read(src string) (map[string]Struct, string, []string, error)

type Struct

type Struct struct {
	Name    string
	Outputs map[string]Field
	Ref     *string
}

func (Struct) RefPkg

func (s Struct) RefPkg() string

type TemplateAndCondition

type TemplateAndCondition interface {
	Template() string
	ShouldGenerate(info GeneratedInfo) bool
}

type TemplateWorkflowGeneratorHelper

type TemplateWorkflowGeneratorHelper struct {
	Templates map[string]TemplateAndCondition
}

func (*TemplateWorkflowGeneratorHelper) Generate

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.1.1

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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL