schema

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package schema provides offline schema validation for GitLab CI/CD pipelines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CrossFieldRule

type CrossFieldRule struct{}

CrossFieldRule validates cross-field dependencies.

func (*CrossFieldRule) Validate

func (r *CrossFieldRule) Validate(job pipeline.Job) []ValidationError

type DurationFormatRule

type DurationFormatRule struct{}

DurationFormatRule validates that duration fields have valid formats.

func (*DurationFormatRule) Validate

func (r *DurationFormatRule) Validate(job pipeline.Job) []ValidationError

type EnumValidationRule

type EnumValidationRule struct{}

EnumValidationRule validates that enum fields have valid values.

func (*EnumValidationRule) Validate

func (r *EnumValidationRule) Validate(job pipeline.Job) []ValidationError

type RequiredFieldsRule

type RequiredFieldsRule struct{}

RequiredFieldsRule validates that required fields are present.

func (*RequiredFieldsRule) Validate

func (r *RequiredFieldsRule) Validate(job pipeline.Job) []ValidationError

type ValidationError

type ValidationError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
	JobName string `json:"job_name,omitempty"`
}

ValidationError represents a single schema validation error.

type ValidationResult

type ValidationResult struct {
	Valid  bool              `json:"valid"`
	Errors []ValidationError `json:"errors,omitempty"`
}

ValidationResult represents the result of a schema validation operation.

type ValidationRule

type ValidationRule interface {
	// Validate checks if the rule passes for a job
	Validate(job pipeline.Job) []ValidationError
}

ValidationRule defines a schema validation rule.

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator provides offline schema validation for GitLab CI/CD configurations.

func NewValidator

func NewValidator() *Validator

NewValidator creates a new schema validator with all default rules.

func (*Validator) ValidateJob

func (v *Validator) ValidateJob(job pipeline.Job) []ValidationError

ValidateJob validates a single job and returns any schema errors.

func (*Validator) ValidatePipeline

func (v *Validator) ValidatePipeline(p pipeline.Pipeline, jobs []pipeline.Job) *ValidationResult

ValidatePipeline validates a pipeline and all its jobs.

Jump to

Keyboard shortcuts

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