validate

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyFailed

func AnyFailed(results []FileResult) bool

func GetOutput

func GetOutput(results []FileResult, opts Options) (string, error)

GetOutput renders validate results as a string. --quiet is silent. JSON is the default when stdout is not a TTY.

func Redact

func Redact(v any) any

Redact replaces secret-shaped values with "***". ${VAR} refs pass through.

Types

type APISpecDTO

type APISpecDTO struct {
	Name             string         `json:"name" yaml:"name"`
	Description      string         `json:"description,omitempty" yaml:"description,omitempty"`
	Authentication   any            `json:"authentication,omitempty" yaml:"authentication,omitempty"`
	Defaults         any            `json:"defaults,omitempty" yaml:"defaults,omitempty"`
	Endpoints        map[string]any `json:"endpoints,omitempty" yaml:"endpoints,omitempty"`
	DynamicEndpoints any            `json:"dynamic_endpoints,omitempty" yaml:"dynamic_endpoints,omitempty"`
	Queues           any            `json:"queues,omitempty" yaml:"queues,omitempty"`
}

APISpecDTO is an API spec without engine-only fields.

type BuildDTO

type BuildDTO struct {
	Target     string         `json:"target,omitempty" yaml:"target,omitempty"`
	Dev        any            `json:"dev,omitempty" yaml:"dev,omitempty"`
	DbtProject any            `json:"dbt_project,omitempty" yaml:"dbt_project,omitempty"`
	Vars       map[string]any `json:"vars,omitempty" yaml:"vars,omitempty"`
	Defaults   any            `json:"defaults,omitempty" yaml:"defaults,omitempty"`
}

BuildDTO is a sling_build.yml file.

type EnvDTO

type EnvDTO struct {
	Connections map[string]any `json:"connections,omitempty" yaml:"connections,omitempty"`
	Env         map[string]any `json:"env,omitempty" yaml:"env,omitempty"`
	Variables   map[string]any `json:"variables,omitempty" yaml:"variables,omitempty"`
}

EnvDTO is an env.yaml file. Values are not interpolated.

type FileResult

type FileResult struct {
	Path     string   `json:"path,omitempty"`
	Kind     Kind     `json:"kind"`
	OK       bool     `json:"ok"`
	Compiled bool     `json:"compiled"`
	Parsed   any      `json:"parsed,omitempty"`
	Error    string   `json:"error,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
}

FileResult is one validated path.

func ParseFile

func ParseFile(path string, opts Options) FileResult

ParseFile parses one explicit file. Directories are rejected.

func ParsePaths

func ParsePaths(paths []string, opts Options) []FileResult

ParsePaths parses each path. Directories are walked. Parse errors stay in the result list so all files are reported.

type Kind

type Kind string

Kind is a Sling YAML document kind.

const (
	KindPipeline    Kind = "pipeline"
	KindReplication Kind = "replication"
	KindAPISpec     Kind = "api_spec"
	KindMonitor     Kind = "monitor"
	KindRoutine     Kind = "routine"
	KindEnv         Kind = "env"
	KindBuild       Kind = "build"
	KindProject     Kind = "project"
	KindUnknown     Kind = "unknown"
)

func DetectFileKind

func DetectFileKind(body []byte, path string) Kind

DetectFileKind classifies a YAML document from parsed root keys. Content rules match VS Code detectSchemaType order. Path rules run only when content matches nothing. sling_build.yml (or a directory that contains one) is the first path exception. env.yaml is the content-unknown fallback.

type Options

type Options struct {
	Compile  bool
	Quiet    bool
	NDJSON   bool
	JSON     bool
	Detailed bool
}

Options controls parse behavior.

type PipelineDTO

type PipelineDTO struct {
	Steps []any          `json:"steps" yaml:"steps"`
	Env   map[string]any `json:"env,omitempty" yaml:"env,omitempty"`
}

PipelineDTO is a pipeline file without engine-only fields.

type ProjectDTO

type ProjectDTO struct {
	Name      string         `json:"name,omitempty" yaml:"name,omitempty"`
	ProjectID string         `json:"project_id,omitempty" yaml:"project_id,omitempty"`
	Jobs      map[string]any `json:"jobs,omitempty" yaml:"jobs,omitempty"`
}

ProjectDTO is a sling_project.yml manifest.

type ReplicationDTO

type ReplicationDTO struct {
	Source   any            `json:"source" yaml:"source"`
	Target   any            `json:"target" yaml:"target"`
	Hooks    any            `json:"hooks,omitempty" yaml:"hooks,omitempty"`
	Defaults any            `json:"defaults,omitempty" yaml:"defaults,omitempty"`
	Streams  map[string]any `json:"streams" yaml:"streams"`
	Env      map[string]any `json:"env,omitempty" yaml:"env,omitempty"`
}

ReplicationDTO is a replication file without engine-only fields.

Jump to

Keyboard shortcuts

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