{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package validation\n\nPackage validation provides shared pipeline configuration validation utilities that are used by both the workflow engine (at startup) and the wfctl CLI tool (as static analysis). This avoids duplicating logic between the two consumers.\n\n## Functions\n\n```go\nfunc ExtractSQLColumns(query string) []string\n```\nExtractSQLColumns parses a SQL SELECT statement and returns the column names (or aliases) from the SELECT clause.\n\n```go\nfunc GenerateChallenge(adminSecret, rejectionHash string, t time.Time) string\n```\nGenerateChallenge generates a 3-word HMAC challenge token for the given rejection hash using the admin secret, anchored to the 1-hour bucket of t. Pass time.Now() for normal use; pass a fixed time in tests for determinism.\n\nadminSecret should come from an environment variable (e.g. WFCTL\\_ADMIN\\_SECRET).\n\n```go\nfunc IsBlockingRefWarningCode(code RefWarningCode) bool\n```\nIsBlockingRefWarningCode reports whether a warning code should fail strict validation. Hyphenated dot-access is non-blocking because the runtime rewrites it, but missing/forward/self refs and invalid output/SQL fields are runtime failures.\n\n```go\nfunc ParseAPIHeaderOverride(r *http.Request) (string, bool)\n```\nParseAPIHeaderOverride extracts an override token from the X-Workflow-Override HTTP request header. Returns (token, true) if present, (\"\", false) otherwise.\n\n```go\nfunc ParsePRCommentOverride(comment string) (string, bool)\n```\nParsePRCommentOverride extracts an override token from a GitHub PR comment. The expected format is \"/wfctl-override \\\u003ctoken\u003e\". Returns (token, true) if found, (\"\", false) otherwise.\n\n```go\nfunc ParseWorkflowDispatchOverride(inputs map[string]string) (string, bool)\n```\nParseWorkflowDispatchOverride extracts an override token from GitHub Actions workflow\\_dispatch inputs. Looks for the key \"override\\_token\" in the inputs map. Returns (token, true) if present, (\"\", false) otherwise.\n\n```go\nfunc TokenFromParts(words []string) string\n```\nTokenFromParts joins three BIP-39 words with hyphens (inverse of parsing).\n\n```go\nfunc VerifyChallenge(adminSecret, rejectionHash, token string, t time.Time) bool\n```\nVerifyChallenge returns true if token matches the expected challenge for the given rejection hash at time t. It checks both the current and previous 1-hour buckets to provide a grace period across bucket boundaries. Comparison is constant-time to prevent timing side-channel attacks.\n\n## Types\n\n```go\ntype RefValidationResult struct {\n\tWarnings     []string\n\tWarningCodes []RefWarningCode\n\tErrors       []string\n}\n```\nRefValidationResult holds the outcome of pipeline template reference validation. Warnings are suspicious but non-fatal references; WarningCodes classifies each warning at the same index. Errors are definitively wrong.\n\n```go\nfunc ValidatePipelineTemplateRefs(pipelines map[string]any, reg ...*schema.StepSchemaRegistry) *RefValidationResult\n```\nValidatePipelineTemplateRefs validates all pipeline step template expressions in the given pipelines map for dangling step references and output field mismatches. It performs the same checks as \\`wfctl template validate\\` at the pipeline template level.\n\nThe pipelines parameter is expected to be a map\\[string]any where each value is a pipeline config map containing a \"steps\" field (as parsed from YAML).\n\nAn optional \\*schema.StepSchemaRegistry may be provided to supply plugin-registered step schemas. When absent, a default built-in registry is created once and reused across all pipelines.\n\n```go\nfunc (r *RefValidationResult) AddWarning(code RefWarningCode, message string)\n```\nAddWarning records a warning and its stable machine-readable code.\n\n```go\nfunc (r *RefValidationResult) BlockingWarningMessages() []string\n```\nBlockingWarningMessages returns warning messages that represent deterministic runtime failures and should fail strict validation.\n\n```go\nfunc (r *RefValidationResult) HasIssues() bool\n```\nHasIssues returns true when there are any warnings or errors.\n\n```go\ntype RefWarningCode string\n```\nRefWarningCode classifies a pipeline reference warning so callers can make policy decisions without parsing human-readable warning text.\n\n```go\nconst (\n\tRefWarningHyphenatedDotAccess RefWarningCode = \"hyphenated_dot_access\"\n\tRefWarningUnknownOutput       RefWarningCode = \"unknown_output\"\n\tRefWarningMissingStep         RefWarningCode = \"missing_step\"\n\tRefWarningSelfReference       RefWarningCode = \"self_reference\"\n\tRefWarningForwardReference    RefWarningCode = \"forward_reference\"\n\tRefWarningSQLColumnMismatch   RefWarningCode = \"sql_column_mismatch\"\n)\n```\n\n","path":"github.com/GoCodeAlone/workflow/validation","name":"validation","synopsis":"Package validation provides shared pipeline configuration validation utilities that are used by both the workflow engine (at startup) and the wfctl CLI tool (as static analysis).","isRedistributable":true}
