validate

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingField     = xerror.PipelineMissingField()
	ErrOrphanStep       = xerror.OrphanStep()
	ErrContractMismatch = xerror.PipelineContractMismatch()
	ErrInvalidFieldPath = xerror.InvalidFieldPath()
)
View Source
var ErrNoPipelineSpecsFound = xerror.NoPipelineSpecsFound()

Functions

func ContractReasonStrings

func ContractReasonStrings() []string

ContractReasonStrings returns a slice of all String values of the enum

func EdgeCompatibilityDetail

func EdgeCompatibilityDetail(diagnostic *EdgeCompatibilityResult) string

EdgeCompatibilityDetail formats expected and actual contract values so validation diagnostics identify the failing field or facet.

func Load

func Load(path string, data []byte) (*pipelinespec.Pipeline, error)

Load decodes and validates a pipeline spec from data.

func LoadFile

func LoadFile(path string) (*pipelinespec.Pipeline, error)

LoadFile reads and validates a single pipeline spec file.

func SinkInputKindForStep

func SinkInputKindForStep(step pipelinespec.Step) model.TransformOutputKind

func StepInputContract

func StepInputContract(step pipelinespec.Step) *payload.Contract

StepInputContract returns the explicit consumer contract for a transform or sink step.

func Validate

func Validate(p *pipelinespec.Pipeline) error

Validate performs structural validation for steps, graph inputs, connectivity, and connector-specific incremental source contracts.

func ValidateDirectory

func ValidateDirectory(root string) (int, error)

ValidateDirectory loads all supported pipeline spec files in a directory tree. It skips known schema files and returns an aggregated error if any spec is invalid.

func ValidateStepInputCompatibility

func ValidateStepInputCompatibility(p *pipelinespec.Pipeline) error

ValidateStepInputCompatibility enforces explicit per-edge contracts and validates inferred edge contracts after the pipeline structure is valid.

Types

type ContractReason

type ContractReason int

ContractReason identifies why an edge contract comparison failed.

const (
	ContractReasonUnknown                ContractReason = iota // unknown
	ContractReasonRepresentationMismatch                       // contract_representation_mismatch
	ContractReasonRootShapeMismatch                            // contract_root_shape_mismatch
	ContractReasonMissingRequiredField                         // contract_missing_required_field
	ContractReasonTypeMismatch                                 // contract_type_mismatch
	ContractReasonNullabilityMismatch                          // contract_nullability_mismatch
	ContractReasonInvalidDefinition                            // contract_invalid_definition
	ContractReasonMissingContract                              // missing_contract
	ContractReasonFieldValidationFailed                        // contract_field_validation_failed
)

func ContractReasonString

func ContractReasonString(s string) (ContractReason, error)

ContractReasonString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ContractReasonValues

func ContractReasonValues() []ContractReason

ContractReasonValues returns all values of the enum

func (ContractReason) IsAContractReason

func (i ContractReason) IsAContractReason() bool

IsAContractReason returns "true" if the value is listed in the enum definition. "false" otherwise

func (ContractReason) MarshalJSON

func (i ContractReason) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ContractReason

func (ContractReason) MarshalText

func (i ContractReason) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for ContractReason

func (ContractReason) String

func (i ContractReason) String() string

func (*ContractReason) UnmarshalJSON

func (i *ContractReason) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ContractReason

func (*ContractReason) UnmarshalText

func (i *ContractReason) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for ContractReason

type EdgeCompatibilityResult

type EdgeCompatibilityResult struct {
	EdgeSlug     string            `json:"edge_slug"`
	FromStepSlug slug.Slug         `json:"from_step_slug"`
	ToStepSlug   slug.Slug         `json:"to_step_slug"`
	Compatible   bool              `json:"compatible"`
	ReasonCode   ContractReason    `json:"reason_code,omitempty"`
	Expected     map[string]string `json:"expected,omitempty"`
	Actual       map[string]string `json:"actual,omitempty"`
}

EdgeCompatibilityResult captures the compatibility decision for one step-input edge.

func AggregateStepInputCompatibilityDiagnostics

func AggregateStepInputCompatibilityDiagnostics(
	p *pipelinespec.Pipeline,
) []EdgeCompatibilityResult

AggregateStepInputCompatibilityDiagnostics returns edge-scoped diagnostics for compatibility failures that involve more than one edge or source-level state.

func EvaluateEdgeCompatibility

func EvaluateEdgeCompatibility(
	edge EdgeLink,
	producer *payload.Contract,
	consumer *payload.Contract,
) EdgeCompatibilityResult

EvaluateEdgeCompatibility compares producer and consumer contracts for one edge. Missing consumer facets are treated as unconstrained in this slice.

func EvaluateEdgeDiagnosticsForSteps

func EvaluateEdgeDiagnosticsForSteps(
	fromStep pipelinespec.Step,
	toStep pipelinespec.Step,
) *EdgeCompatibilityResult

evaluateEdgeDiagnosticsForSteps assesses contract-based compatibility for one step-to-step edge.

type EdgeContext

type EdgeContext struct {
	FromStep pipelinespec.Step
	ToStep   pipelinespec.Step
}

func StepEdgeContexts

func StepEdgeContexts(p *pipelinespec.Pipeline) ([]EdgeContext, error)
type EdgeLink struct {
	FromStep slug.Slug
	ToStep   slug.Slug
}

EdgeLink identifies a directional data-flow edge between two step slugs.

Jump to

Keyboard shortcuts

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