{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package schema\n\nPackage schema provides JSON Schema generation and validation for workflow configuration files. It generates a JSON Schema from the known config structure and module types, and validates parsed configs against it.\n\n## Constants\n\n```go\nconst (\n\tEditorBundleSchemaVersion = \"editor-bundle/v1\"\n\n\tEditorContractSourceBuiltin             = \"builtin\"\n\tEditorContractSourcePluginManifest      = \"plugin-manifest\"\n\tEditorContractSourcePluginContractsJSON = \"plugin-contracts-json\"\n\tEditorContractSourceLivePlugin          = \"live-plugin\"\n)\n```\n\n## Functions\n\n```go\nfunc CamelToSnake(s string) string\n```\nCamelToSnake converts a camelCase identifier to its snake\\_case equivalent. For example: \"contentType\" → \"content\\_type\", \"dbPath\" → \"db\\_path\". It treats consecutive uppercase letters (acronyms) as a single word: \"webhookURL\" → \"webhook\\_url\", \"HTTPRequest\" → \"http\\_request\".\n\n```go\nfunc CoreModuleTypes() []string\n```\nCoreModuleTypes returns only the hardcoded built-in module type identifiers. Use this when you need the original list without any plugin-provided types.\n\n```go\nfunc ExportSnippetsJetBrains() ([]byte, error)\n```\nExportSnippetsJetBrains returns all snippets in JetBrains live template XML format. The output can be saved to a .xml file in the JetBrains templates directory.\n\n```go\nfunc ExportSnippetsVSCode() ([]byte, error)\n```\nExportSnippetsVSCode returns all snippets in VSCode snippet JSON format. The output can be saved to a .code-snippets file or a language-specific snippet file in the .vscode directory.\n\n```go\nfunc HandleGetModuleSchemas(w http.ResponseWriter, r *http.Request)\n```\nHandleGetModuleSchemas serves module config schemas. Query parameters:\n\n  - type: return schema for a specific module type (e.g. ?type=http.server)\n\nWithout ?type, returns all schemas as a map keyed by module type.\n\n```go\nfunc HandleGetSchema(w http.ResponseWriter, _ *http.Request)\n```\nHandleGetSchema serves the workflow JSON schema.\n\n```go\nfunc HandleSchemaAPI(w http.ResponseWriter, r *http.Request)\n```\nHandleSchemaAPI dispatches schema-related API requests. It handles:\n\n  - /api/schema            → workflow JSON schema\n  - /api/v1/module-schemas → module config schemas (all or by type)\n\n```go\nfunc KnownModuleTypes() []string\n```\nKnownModuleTypes returns all built-in module type identifiers plus any types registered at runtime by plugins. The result is sorted and deduplicated.\n\n```go\nfunc KnownStepTypes() map[string]bool\n```\nKnownStepTypes returns all step type identifiers derived from KnownModuleTypes by filtering for types with the \"step.\" prefix. This ensures the set is always complete and consistent with the module type registry.\n\n```go\nfunc KnownTriggerTypes() []string\n```\nKnownTriggerTypes returns all built-in trigger type identifiers plus any types registered at runtime by plugins. The result is sorted and deduplicated.\n\n```go\nfunc KnownWorkflowTypes() []string\n```\nKnownWorkflowTypes returns all built-in workflow handler type identifiers plus any types registered at runtime by plugins. The result is sorted and deduplicated.\n\n```go\nfunc LoadPluginStepSchemasFromDir(pluginDir string)\n```\nLoadPluginStepSchemasFromDir scans pluginDir for subdirectories containing a plugin.json manifest, reads each manifest's stepSchemas field, and registers them in the global StepSchemaRegistry. Unknown or malformed manifests are silently skipped.\n\n```go\nfunc LoadPluginStepSchemasFromManifest(manifestPath string)\n```\nLoadPluginStepSchemasFromManifest reads a single plugin.json file and registers any stepSchemas it declares. Missing files or invalid JSON are silently ignored to match LoadPluginStepSchemasFromDir's tolerant behavior; callers that need strict feedback should use LoadPluginTypesFromManifest in parallel.\n\n```go\nfunc LoadPluginTypesFromDir(pluginDir string) error\n```\nLoadPluginTypesFromDir scans pluginDir for subdirectories containing a plugin.json manifest, reads each manifest's type declarations, and registers them with the schema package so that they appear in all type listings and pass validation. Unknown or malformed manifests are silently skipped. Returns an error only if pluginDir cannot be read at all.\n\n```go\nfunc LoadPluginTypesFromManifest(manifestPath string) error\n```\nLoadPluginTypesFromManifest reads a single plugin.json file at manifestPath and registers its declared module/step/trigger/workflow/resource types with the schema package. Returns an error if the file cannot be read or is not valid JSON; this is the explicit-path counterpart to LoadPluginTypesFromDir and surfaces problems instead of silently skipping them.\n\n```go\nfunc RegisterModuleType(moduleType string)\n```\nRegisterModuleType registers a module type so it is recognized by KnownModuleTypes.\n\n```go\nfunc RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers the schema API endpoint on the given mux.\n\n```go\nfunc RegisterTriggerType(triggerType string)\n```\nRegisterTriggerType registers a trigger type so it is recognized by KnownTriggerTypes.\n\n```go\nfunc RegisterWorkflowType(workflowType string)\n```\nRegisterWorkflowType registers a workflow type so it is recognized by KnownWorkflowTypes.\n\n```go\nfunc UnregisterModuleType(moduleType string)\n```\nUnregisterModuleType removes a dynamically registered module type. Intended for testing.\n\n```go\nfunc UnregisterTriggerType(triggerType string)\n```\nUnregisterTriggerType removes a dynamically registered trigger type. Intended for testing.\n\n```go\nfunc UnregisterWorkflowType(workflowType string)\n```\nUnregisterWorkflowType removes a dynamically registered workflow type. Intended for testing.\n\n```go\nfunc ValidateConfig(cfg *config.WorkflowConfig, opts ...ValidationOption) error\n```\nValidateConfig validates a parsed WorkflowConfig, returning all detected problems. Returns nil if the config is valid.\n\n## Types\n\n```go\ntype AttachSpec struct {\n\tTo   string `json:\"to,omitempty\" yaml:\"to,omitempty\"`\n\tEmit string `json:\"emit,omitempty\" yaml:\"emit,omitempty\"`\n}\n```\nAttachSpec declares how a module attaches to another (Category A): To = target module type; Emit = the entry-point section key to emit (e.g. \"workflows.http\").\n\n```go\ntype ConfigFieldDef struct {\n\tKey           string          `json:\"key\"`\n\tLabel         string          `json:\"label\"`\n\tType          ConfigFieldType `json:\"type\"`\n\tDescription   string          `json:\"description,omitempty\"`\n\tRequired      bool            `json:\"required,omitempty\"`\n\tDefaultValue  any             `json:\"defaultValue,omitempty\"`\n\tOptions       []string        `json:\"options,omitempty\"` // for select type\n\tPlaceholder   string          `json:\"placeholder,omitempty\"`\n\tGroup         string          `json:\"group,omitempty\"`         // field grouping in UI\n\tArrayItemType string          `json:\"arrayItemType,omitempty\"` // element type for array fields (\"string\", \"number\", etc.)\n\tMapValueType  string          `json:\"mapValueType,omitempty\"`  // value type for map fields (\"string\", \"number\", etc.)\n\tInheritFrom   string          `json:\"inheritFrom,omitempty\"`   // \"{edgeType}.{sourceField}\" pattern for config inheritance from connected nodes\n\tSensitive     bool            `json:\"sensitive,omitempty\"`     // when true, the UI renders this as a password field with visibility toggle\n}\n```\nConfigFieldDef describes a single configuration field for a module type.\n\n```go\nfunc GenerateConfigFields(configStruct interface{}) []ConfigFieldDef\n```\nGenerateConfigFields produces ConfigFieldDef entries from a Go struct's field tags. Fields without an \\`editor\\` tag are skipped. The \\`json\\` tag provides the key name.\n\n```go\ntype ConfigFieldType string\n```\nConfigFieldType represents the type of a configuration field.\n\n```go\nconst (\n\tFieldTypeString   ConfigFieldType = \"string\"\n\tFieldTypeNumber   ConfigFieldType = \"number\"\n\tFieldTypeBool     ConfigFieldType = \"boolean\"\n\tFieldTypeSelect   ConfigFieldType = \"select\"\n\tFieldTypeJSON     ConfigFieldType = \"json\"\n\tFieldTypeDuration ConfigFieldType = \"duration\"\n\tFieldTypeArray    ConfigFieldType = \"array\"\n\tFieldTypeMap      ConfigFieldType = \"map\"\n\tFieldTypeFilePath ConfigFieldType = \"filepath\"\n\tFieldTypeSQL      ConfigFieldType = \"sql\"\n)\n```\n\n```go\ntype EditorBundleOptions struct {\n\tWorkflowVersion    string\n\tContractRegistries []EditorContractRegistrySource\n}\n```\n\n```go\ntype EditorContractBundle struct {\n\tVersion         string                               `json:\"version\"`\n\tWorkflowVersion string                               `json:\"workflowVersion\"`\n\tModuleSchemas   map[string]*ModuleSchema             `json:\"moduleSchemas\"`\n\tStepSchemas     map[string]*StepSchema               `json:\"stepSchemas\"`\n\tCoercionRules   map[string][]string                  `json:\"coercionRules\"`\n\tContracts       map[string]*EditorContractDescriptor `json:\"contracts\"`\n\tMessages        map[string]*EditorMessageDescriptor  `json:\"messages\"`\n\tDescriptorSets  map[string]*EditorDescriptorSet      `json:\"descriptorSets\"`\n\tDSLReference    any                                  `json:\"dslReference,omitempty\"`\n\tSchemas         EditorYAMLSchemas                    `json:\"schemas\"`\n\tSnippets        []EditorSnippet                      `json:\"snippets\"`\n}\n```\n\n```go\nfunc ExportEditorBundle(opts EditorBundleOptions) (*EditorContractBundle, error)\n```\n\n```go\ntype EditorContractDescriptor struct {\n\tID               string   `json:\"id\"`\n\tPlugin           string   `json:\"plugin,omitempty\"`\n\tOwnerType        string   `json:\"ownerType\"`\n\tOwnerKey         string   `json:\"ownerKey\"`\n\tMode             string   `json:\"mode\"`\n\tRequestMessage   string   `json:\"requestMessage,omitempty\"`\n\tResponseMessage  string   `json:\"responseMessage,omitempty\"`\n\tConfigMessage    string   `json:\"configMessage,omitempty\"`\n\tDescriptorSetRef string   `json:\"descriptorSetRef,omitempty\"`\n\tSource           string   `json:\"source\"`\n\tContractType     string   `json:\"contractType,omitempty\"`\n\tProtoPackage     string   `json:\"protoPackage,omitempty\"`\n\tMessageNames     []string `json:\"messageNames,omitempty\"`\n\tGoImportPath     string   `json:\"goImportPath,omitempty\"`\n\tSchemaDigest     string   `json:\"schemaDigest,omitempty\"`\n\tProtocolVersion  string   `json:\"protocolVersion,omitempty\"`\n}\n```\n\n```go\ntype EditorContractRegistrySource struct {\n\tPlugin                    string\n\tSource                    string\n\tRegistry                  *pb.ContractRegistry\n\tDescriptorSetRef          string\n\tContractDescriptorSetRefs map[string]string\n}\n```\n\n```go\ntype EditorDescriptorSet struct {\n\tID              string   `json:\"id\"`\n\tPlugin          string   `json:\"plugin,omitempty\"`\n\tEncoding        string   `json:\"encoding\"`\n\tSHA256          string   `json:\"sha256,omitempty\"`\n\tEmbeddedBase64  string   `json:\"embeddedBase64,omitempty\"`\n\tFileCount       int      `json:\"fileCount\"`\n\tMessageCount    int      `json:\"messageCount\"`\n\tMessageNames    []string `json:\"messageNames\"`\n\tExternalRef     string   `json:\"externalRef,omitempty\"`\n\tExternalRefType string   `json:\"externalRefType,omitempty\"`\n}\n```\n\n```go\ntype EditorMessageDescriptor struct {\n\tName             string               `json:\"name\"`\n\tFullName         string               `json:\"fullName\"`\n\tFields           []EditorMessageField `json:\"fields\"`\n\tDescriptorSetRef string               `json:\"descriptorSetRef,omitempty\"`\n}\n```\n\n```go\ntype EditorMessageField struct {\n\tName        string `json:\"name\"`\n\tJSONName    string `json:\"jsonName,omitempty\"`\n\tNumber      int32  `json:\"number\"`\n\tType        string `json:\"type\"`\n\tMessageType string `json:\"messageType,omitempty\"`\n\tEnumType    string `json:\"enumType,omitempty\"`\n\tRepeated    bool   `json:\"repeated,omitempty\"`\n\tMap         bool   `json:\"map,omitempty\"`\n}\n```\n\n```go\ntype EditorSnippet struct {\n\tName        string   `json:\"name\"`\n\tPrefix      string   `json:\"prefix\"`\n\tDescription string   `json:\"description,omitempty\"`\n\tBody        []string `json:\"body\"`\n}\n```\n\n```go\ntype EditorYAMLSchemas struct {\n\tApp   *Schema `json:\"app\"`\n\tInfra *Schema `json:\"infra,omitempty\"`\n\tWfctl *Schema `json:\"wfctl,omitempty\"`\n}\n```\n\n```go\ntype EventSchema struct {\n\tType        string              `json:\"type\" yaml:\"type\"`                             // e.g., \"order.created\"\n\tVersion     string              `json:\"version\" yaml:\"version\"`                       // semver\n\tDescription string              `json:\"description\" yaml:\"description\"`               // human-readable description\n\tFields      map[string]FieldDef `json:\"fields\" yaml:\"fields\"`                         // field name -\u003e definition\n\tRequired    []string            `json:\"required\" yaml:\"required\"`                     // required field names\n\tExamples    []map[string]any    `json:\"examples,omitempty\" yaml:\"examples,omitempty\"` // example data payloads\n}\n```\nEventSchema describes the expected shape of event data for a specific event type and version.\n\n```go\ntype EventSchemaRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nEventSchemaRegistry stores and validates event schemas keyed by \"type:version\".\n\n```go\nfunc NewEventSchemaRegistry() *EventSchemaRegistry\n```\nNewEventSchemaRegistry creates a new empty event schema registry.\n\n```go\nfunc (r *EventSchemaRegistry) Get(eventType, version string) (*EventSchema, bool)\n```\nGet retrieves an event schema by type and version. Returns nil and false if not found.\n\n```go\nfunc (r *EventSchemaRegistry) GetLatest(eventType string) (*EventSchema, bool)\n```\nGetLatest returns the latest version of the schema for a given event type, determined by lexicographic comparison of semantic version strings. Returns nil and false if no schema exists for the type.\n\n```go\nfunc (r *EventSchemaRegistry) List() []*EventSchema\n```\nList returns all registered schemas as a slice, sorted by type then version.\n\n```go\nfunc (r *EventSchemaRegistry) ListTypes() []string\n```\nListTypes returns all unique registered event types, sorted alphabetically.\n\n```go\nfunc (r *EventSchemaRegistry) Register(schema *EventSchema) error\n```\nRegister validates and stores an event schema. It returns an error if a schema with the same type and version is already registered, or if the schema is missing required metadata.\n\n```go\nfunc (r *EventSchemaRegistry) Remove(eventType, version string) bool\n```\nRemove deletes a schema identified by event type and version. Returns true if the schema was found and removed, false otherwise.\n\n```go\nfunc (r *EventSchemaRegistry) Validate(eventType string, data map[string]any) error\n```\nValidate validates the given data map against the latest schema for the specified event type. Returns nil if valid, or an EventValidationErrors containing all failures.\n\n```go\nfunc (r *EventSchemaRegistry) ValidateVersion(eventType, version string, data map[string]any) error\n```\nValidateVersion validates data against a specific version of the schema.\n\n```go\ntype EventValidationError struct {\n\tField   string\n\tMessage string\n}\n```\nEventValidationError represents a single event data validation failure.\n\n```go\nfunc (e *EventValidationError) Error() string\n```\n\n```go\ntype EventValidationErrors []*EventValidationError\n```\nEventValidationErrors collects multiple event validation failures.\n\n```go\nfunc (ve EventValidationErrors) Error() string\n```\n\n```go\ntype FieldDef struct {\n\tType        string   `json:\"type\" yaml:\"type\"`                         // string, number, boolean, object, array\n\tDescription string   `json:\"description\" yaml:\"description\"`           // human-readable description\n\tEnum        []string `json:\"enum,omitempty\" yaml:\"enum,omitempty\"`     // allowed values (if constrained)\n\tFormat      string   `json:\"format,omitempty\" yaml:\"format,omitempty\"` // email, uri, date-time, uuid\n}\n```\nFieldDef describes a single field within an event data payload.\n\n```go\ntype FragmentSpec struct {\n\tKind   string   `json:\"kind\" yaml:\"kind\"`\n\tFields []string `json:\"fields,omitempty\" yaml:\"fields,omitempty\"`\n}\n```\nFragmentSpec declares a YAML fragment this module emits (Category A): Kind names a closed-set template; Fields are required substitution placeholders (validated present at grammar-load, D20).\n\n```go\ntype GrammarDecl struct {\n\tProvides         []string      `json:\"provides,omitempty\" yaml:\"provides,omitempty\"`\n\tRequires         []string      `json:\"requires,omitempty\" yaml:\"requires,omitempty\"`\n\tAttaches         *AttachSpec   `json:\"attaches,omitempty\" yaml:\"attaches,omitempty\"`\n\tRouteMiddlewares []string      `json:\"routeMiddlewares,omitempty\" yaml:\"routeMiddlewares,omitempty\"`\n\tFragment         *FragmentSpec `json:\"fragment,omitempty\" yaml:\"fragment,omitempty\"`\n\tRuntimeHooks     []string      `json:\"runtimeHooks,omitempty\" yaml:\"runtimeHooks,omitempty\"`\n}\n```\nGrammarDecl is the plugin-manifest grammar subset (a ModuleSchema minus the non-grammar fields) — used in PluginManifest.Grammar map\\[string]GrammarDecl (Task 2).\n\n```go\ntype InferredOutput struct {\n\tKey         string `json:\"key\"`\n\tType        string `json:\"type\"`\n\tDescription string `json:\"description,omitempty\"`\n}\n```\nInferredOutput describes a single inferred output key for a step instance.\n\n```go\ntype ModuleSchema struct {\n\tType          string           `json:\"type\" yaml:\"type\"`\n\tLabel         string           `json:\"label\" yaml:\"label\"`\n\tCategory      string           `json:\"category\" yaml:\"category\"`\n\tDescription   string           `json:\"description,omitempty\" yaml:\"description,omitempty\"`\n\tInputs        []ServiceIODef   `json:\"inputs,omitempty\" yaml:\"inputs,omitempty\"`\n\tOutputs       []ServiceIODef   `json:\"outputs,omitempty\" yaml:\"outputs,omitempty\"`\n\tConfigFields  []ConfigFieldDef `json:\"configFields\" yaml:\"configFields\"`\n\tDefaultConfig map[string]any   `json:\"defaultConfig,omitempty\" yaml:\"defaultConfig,omitempty\"`\n\tMaxIncoming   *int             `json:\"maxIncoming,omitempty\" yaml:\"maxIncoming,omitempty\"` // nil=unlimited, 0=none, N=limit\n\tMaxOutgoing   *int             `json:\"maxOutgoing,omitempty\" yaml:\"maxOutgoing,omitempty\"`\n\n\t// Assembly Grammar (D7). Additive; all optional (omitzero via omitempty).\n\tProvides         []string      `json:\"provides,omitempty\" yaml:\"provides,omitempty\"`\n\tRequires         []string      `json:\"requires,omitempty\" yaml:\"requires,omitempty\"`\n\tAttaches         *AttachSpec   `json:\"attaches,omitempty\" yaml:\"attaches,omitempty\"`\n\tRouteMiddlewares []string      `json:\"routeMiddlewares,omitempty\" yaml:\"routeMiddlewares,omitempty\"`\n\tFragment         *FragmentSpec `json:\"fragment,omitempty\" yaml:\"fragment,omitempty\"`\n\tRuntimeHooks     []string      `json:\"runtimeHooks,omitempty\" yaml:\"runtimeHooks,omitempty\"`\n}\n```\nModuleSchema describes the full configuration schema for a module type.\n\nGrammar fields (D7 — extends ModuleSchema, one source of truth):\n\n  - Category A (declarative-emittable): Provides/Requires/Attaches/RouteMiddlewares/Fragment.\n  - Category B (documented runtime preconditions, ⊥ emit): RuntimeHooks (D3).\n\n```go\ntype ModuleSchemaRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nModuleSchemaRegistry holds all known module configuration schemas.\n\n```go\nfunc GetModuleSchemaRegistry() *ModuleSchemaRegistry\n```\nGetModuleSchemaRegistry returns the global module schema registry, allowing callers to register additional schemas (e.g., custom module types).\n\n```go\nfunc NewModuleSchemaRegistry() *ModuleSchemaRegistry\n```\nNewModuleSchemaRegistry creates a new registry with all built-in module schemas pre-registered.\n\n```go\nfunc NewModuleSchemaRegistryWithoutBuiltins() *ModuleSchemaRegistry\n```\nNewModuleSchemaRegistryWithoutBuiltins returns an empty registry with no pre-registered builtins, so callers (notably grammar-mechanics tests) can control exactly which types carry grammar without the builtin sweep contributing.\n\n```go\nfunc (r *ModuleSchemaRegistry) All() []*ModuleSchema\n```\nAll returns all registered schemas as a slice.\n\n```go\nfunc (r *ModuleSchemaRegistry) AllMap() map[string]*ModuleSchema\n```\nAllMap returns all registered schemas as a map keyed by module type.\n\n```go\nfunc (r *ModuleSchemaRegistry) Get(moduleType string) *ModuleSchema\n```\nGet returns the schema for a module type, or nil if not found.\n\n```go\nfunc (r *ModuleSchemaRegistry) Register(s *ModuleSchema)\n```\nRegister adds or replaces a module schema.\n\n```go\nfunc (r *ModuleSchemaRegistry) Types() []string\n```\nTypes returns a sorted list of all registered module type identifiers. This is the dynamic equivalent of KnownModuleTypes — it includes both built-in types and any types registered at runtime by plugins.\n\n```go\nfunc (r *ModuleSchemaRegistry) Unregister(moduleType string)\n```\nUnregister removes a module schema by type. Intended for cleanup during testing.\n\n```go\ntype Schema struct {\n\tSchema               string             `json:\"$schema,omitempty\"`\n\tTitle                string             `json:\"title,omitempty\"`\n\tDescription          string             `json:\"description,omitempty\"`\n\tType                 string             `json:\"type,omitempty\"`\n\tRequired             []string           `json:\"required,omitempty\"`\n\tProperties           map[string]*Schema `json:\"properties,omitempty\"`\n\tItems                *Schema            `json:\"items,omitempty\"`\n\tEnum                 []string           `json:\"enum,omitempty\"`\n\tAdditionalProperties json.RawMessage    `json:\"additionalProperties,omitempty\"`\n\tAnyOf                []*Schema          `json:\"anyOf,omitempty\"`\n\tOneOf                []*Schema          `json:\"oneOf,omitempty\"`\n\tAllOf                []*Schema          `json:\"allOf,omitempty\"`\n\tIf                   *Schema            `json:\"if,omitempty\"`\n\tThen                 *Schema            `json:\"then,omitempty\"`\n\tDefault              any                `json:\"default,omitempty\"`\n\tMinItems             *int               `json:\"minItems,omitempty\"`\n\tMinimum              *float64           `json:\"minimum,omitempty\"`\n\tPattern              string             `json:\"pattern,omitempty\"`\n\tDefinitions          map[string]*Schema `json:\"$defs,omitempty\"`\n\tRef                  string             `json:\"$ref,omitempty\"`\n}\n```\nSchema represents a JSON Schema document.\n\n```go\nfunc GenerateApplicationSchema() *Schema\n```\nGenerateApplicationSchema produces a JSON Schema for application-level configs.\n\n```go\nfunc GenerateInfraSchema() *Schema\n```\n\n```go\nfunc GenerateWfctlSchema() *Schema\n```\n\n```go\nfunc GenerateWorkflowSchema() *Schema\n```\nGenerateWorkflowSchema produces the full JSON Schema describing a valid WorkflowConfig YAML file.\n\n```go\ntype SchemaService struct{}\n```\nSchemaService wraps the schema handlers as an http.Handler for delegate dispatch.\n\n```go\nfunc NewSchemaService() *SchemaService\n```\nNewSchemaService creates a new SchemaService.\n\n```go\nfunc (s *SchemaService) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP implements http.Handler for config-driven delegate dispatch.\n\n```go\ntype ServiceIODef struct {\n\tName        string `json:\"name\"`\n\tType        string `json:\"type\"`\n\tDescription string `json:\"description,omitempty\"`\n}\n```\nServiceIODef describes a single input or output service port for a module type.\n\n```go\ntype Snippet struct {\n\tName        string   // human-readable name\n\tPrefix      string   // trigger prefix / keyword\n\tDescription string   // short description shown in IDE\n\tBody        []string // lines of the snippet body\n}\n```\nSnippet represents a code snippet for IDE support. Body uses ${N:placeholder} VSCode-style syntax.\n\n```go\nfunc GetSnippets() []Snippet\n```\nGetSnippets returns the canonical set of workflow configuration snippets.\n\n```go\ntype StepOutputDef struct {\n\tKey         string `json:\"key\"`\n\tType        string `json:\"type\"`\n\tDescription string `json:\"description,omitempty\"`\n}\n```\nStepOutputDef describes a single output key produced by a pipeline step.\n\n```go\ntype StepSchema struct {\n\tType         string           `json:\"type\"`\n\tPlugin       string           `json:\"plugin,omitempty\"`\n\tDescription  string           `json:\"description\"`\n\tConfigFields []ConfigFieldDef `json:\"configFields\"`\n\tOutputs      []StepOutputDef  `json:\"outputs,omitempty\"`\n\tReadKeys     []string         `json:\"readKeys,omitempty\"` // template keys this step typically reads (e.g. \".body\", \".current\")\n}\n```\nStepSchema describes the full schema for a pipeline step type, including config fields, outputs, and context keys the step reads.\n\n```go\ntype StepSchemaRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nStepSchemaRegistry holds all known step configuration schemas.\n\n```go\nfunc GetStepSchemaRegistry() *StepSchemaRegistry\n```\nGetStepSchemaRegistry returns the global step schema registry, allowing callers to register additional schemas (e.g., plugin step types).\n\n```go\nfunc NewStepSchemaRegistry() *StepSchemaRegistry\n```\nNewStepSchemaRegistry creates a new registry with all built-in step schemas pre-registered.\n\n```go\nfunc (r *StepSchemaRegistry) All() []*StepSchema\n```\nAll returns all registered schemas as a slice.\n\n```go\nfunc (r *StepSchemaRegistry) AllMap() map[string]*StepSchema\n```\nAllMap returns all registered schemas as a map keyed by step type.\n\n```go\nfunc (r *StepSchemaRegistry) Get(stepType string) *StepSchema\n```\nGet returns the schema for a step type, or nil if not found.\n\n```go\nfunc (r *StepSchemaRegistry) InferStepOutputs(stepType string, stepConfig map[string]any) []InferredOutput\n```\nInferStepOutputs computes output fields for a step given its type and config. For config-dependent steps (step.set, step.db\\_query), it produces precise outputs based on the actual config values. Falls back to static schema outputs for all other types.\n\n```go\nfunc (r *StepSchemaRegistry) Register(s *StepSchema)\n```\nRegister adds or replaces a step schema.\n\n```go\nfunc (r *StepSchemaRegistry) Types() []string\n```\nTypes returns a sorted list of all registered step type identifiers.\n\n```go\nfunc (r *StepSchemaRegistry) Unregister(stepType string)\n```\nUnregister removes a step schema by type.\n\n```go\ntype TypeCoercionRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nTypeCoercionRegistry defines which output types can connect to which input types beyond exact match. This is the single source of truth — the editor reads it via \\`wfctl editor-schemas\\`.\n\n```go\nfunc NewTypeCoercionRegistry() *TypeCoercionRegistry\n```\nNewTypeCoercionRegistry creates a registry with all built-in coercion rules.\n\n```go\nfunc (r *TypeCoercionRegistry) Rules() map[string][]string\n```\nRules returns the full coercion rules map.\n\n```go\ntype ValidationError struct {\n\tPath    string // dot-separated path (e.g. \"modules[0].type\")\n\tMessage string\n}\n```\nValidationError represents a single validation failure with the path to the offending field and a human-readable message.\n\n```go\nfunc (e *ValidationError) Error() string\n```\n\n```go\ntype ValidationErrors []*ValidationError\n```\nValidationErrors collects multiple validation failures.\n\n```go\nfunc (ve ValidationErrors) Error() string\n```\n\n```go\ntype ValidationOption func(*validationOpts)\n```\nValidationOption configures validation behaviour.\n\n```go\nfunc WithAllowEmptyModules() ValidationOption\n```\nWithAllowEmptyModules disables the \"at least one module\" requirement.\n\n```go\nfunc WithAllowNoEntryPoints() ValidationOption\n```\nWithAllowNoEntryPoints disables the check that requires at least one entry point (trigger, HTTP route, messaging subscription, or scheduler job).\n\n```go\nfunc WithExtraModuleTypes(types ...string) ValidationOption\n```\nWithExtraModuleTypes registers additional module types as valid (e.g. from custom factories registered via AddModuleType).\n\n```go\nfunc WithExtraTriggerTypes(types ...string) ValidationOption\n```\nWithExtraTriggerTypes registers additional trigger types as valid.\n\n```go\nfunc WithExtraWorkflowTypes(types ...string) ValidationOption\n```\nWithExtraWorkflowTypes registers additional workflow handler types as valid.\n\n```go\nfunc WithSkipModuleTypeCheck() ValidationOption\n```\nWithSkipModuleTypeCheck disables validation of module type identifiers. Useful for validating configs that use custom or placeholder module types.\n\n```go\nfunc WithSkipTriggerTypeCheck() ValidationOption\n```\nWithSkipTriggerTypeCheck disables validation of trigger section keys. Useful when the engine resolves trigger types dynamically.\n\n```go\nfunc WithSkipWorkflowTypeCheck() ValidationOption\n```\nWithSkipWorkflowTypeCheck disables validation of workflow section keys. Useful when the engine resolves workflow types dynamically via handlers.\n\n","path":"github.com/GoCodeAlone/workflow/schema","name":"schema","synopsis":"Package schema provides JSON Schema generation and validation for workflow configuration files.","isRedistributable":true}
