manifest

package
v0.0.0-...-99f4f86 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package manifest loads and validates module.yaml manifests into typed structs. See docs/architecture.md for the manifest schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(m *Manifest) error

Validate checks a decoded Manifest against the module schema, collecting every violation before returning. A nil error means m is well-formed; a non-nil error is always a *ValidationError.

Types

type Dependency

type Dependency struct {
	Module  string `yaml:"module"`
	Package string `yaml:"package"`
	Version string `yaml:"version"`
}

Dependency is a single dependency contributed to the generated project's dependency manifest. Exactly one of Module (Go) or Package (npm) is set, matching the language it appears under.

type EnvVar

type EnvVar struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Required    bool   `yaml:"required"`
	Default     string `yaml:"default"` // must be empty when Required is true
}

EnvVar describes one environment variable a project needs to configure when the declaring module is selected.

type FieldError

type FieldError struct {
	Field   string
	Message string
}

FieldError describes a single validation failure at a field path, e.g. "languages.go.templates[0].to".

func (FieldError) Error

func (e FieldError) Error() string

type Language

type Language struct {
	Dependencies []Dependency `yaml:"dependencies"`
	Templates    []Template   `yaml:"templates"`
}

Language is a per-language implementation of a module: the dependencies it introduces and the templates it renders.

type Manifest

type Manifest struct {
	APIVersion string `yaml:"apiVersion"`
	Name       string `yaml:"name"`
	Version    string `yaml:"version"`
	Summary    string `yaml:"summary"`

	Tags      []string `yaml:"tags"`
	Requires  []string `yaml:"requires"`
	Conflicts []string `yaml:"conflicts"`

	// EnvVars describes the environment variables a project needs to
	// configure when this module is selected. It does not mean this
	// module's own Go code calls os.Getenv directly — none of the shipped
	// modules do; secrets and settings are passed as constructor
	// parameters instead (e.g. ProviderStripe(secret)). This field exists
	// so tooling — the renderer's env var aggregation — can generate an
	// accurate .env.example for the generated project, not to describe
	// this module's internal implementation.
	EnvVars []EnvVar `yaml:"env"`

	Languages map[string]Language `yaml:"languages"`
}

Manifest is the decoded, unvalidated form of a module.yaml file.

func Load

func Load(r io.Reader, name string) (*Manifest, error)

Load decodes a module.yaml manifest from r. name identifies the source (typically a file path) and is used only to label errors.

Decoding is strict: unknown fields and duplicate keys are rejected. It does not validate the manifest's contents — call Validate for that.

func LoadFile

func LoadFile(path string) (*Manifest, error)

LoadFile reads and decodes the manifest at path. See Load for decoding semantics.

type Template

type Template struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

Template maps a source template file to a destination path relative to the generated project root.

type ValidationError

type ValidationError struct {
	Errors []FieldError
}

ValidationError aggregates every FieldError found while validating a Manifest, rather than stopping at the first one.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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