format

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package format owns canonical pipeline spec formatting for editor, builder, preview, and CLI workflows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Code               string `json:"code"`
	Message            string `json:"message"`
	StepSlug           string `json:"step_slug"`
	ReferencedStepSlug string `json:"referenced_step_slug"`
}

Diagnostic reports formatter-only issues that affected canonical ordering.

func FormatData

func FormatData(format string, data []byte) ([]byte, []Diagnostic, error)

FormatData parses serialized JSON or YAML pipeline data using the explicit format requested by the caller and emits formatted data in the same format.

func FormatJSON

func FormatJSON(pipeline *pipelinespec.Pipeline) ([]byte, []Diagnostic, error)

FormatJSON returns canonical indented JSON for the formatted pipeline spec.

type Result

type Result struct {
	Spec        pipelinespec.Pipeline `json:"spec"`
	Diagnostics []Diagnostic          `json:"diagnostics"`
}

Result is the formatted pipeline spec plus non-fatal formatter diagnostics.

func Format

func Format(pipeline *pipelinespec.Pipeline) (Result, error)

Format returns a copy of the pipeline with steps ordered for stable visual layout. It intentionally does not call pipeline validation: formatting must tolerate draft-like specs and report only diagnostics for references that affect ordering.

Jump to

Keyboard shortcuts

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