recipe

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package recipe owns the embedded-and-installable validator recipes that aiwf ships out of the box.

A recipe is a single markdown file with a YAML frontmatter block that declares a validator. The frontmatter is the validator block the install verb appends to aiwf.yaml.contracts.validators; the markdown body is documentation served by `aiwf contract recipe show`.

Frontmatter shape:

---
name: <validator-name>
command: <executable>
args:
  - <argv elements, may include {{schema}} {{fixture}} {{contract_id}} {{version}}>
---

Two recipes ship in I1 — `cue` and `jsonschema`. New recipes are added by dropping a markdown file into embedded/ and rebuilding; no engine code change is required.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("recipe not found")

ErrNotFound is returned when a requested recipe name is not in the embedded set.

Functions

This section is empty.

Types

type Recipe

type Recipe struct {
	Name      string
	Validator aiwfyaml.Validator
	Markdown  []byte
}

Recipe is the parsed, ready-to-install form of an embedded recipe. Validator carries the bytes that will land in aiwf.yaml.contracts.validators[Name]; Markdown is the full documentation including the frontmatter (so `recipe show` can reproduce the file as authored).

func Get

func Get(name string) (Recipe, error)

Get returns the embedded recipe named name, or ErrNotFound if no embedded recipe carries that name in its frontmatter. The lookup is by frontmatter `name:`, not filename — though the convention is for them to match.

func List

func List() ([]Recipe, error)

List returns every embedded recipe in name-sorted order. The byte content is freshly read from the embed each call.

func ParseFile

func ParseFile(path string) (Recipe, error)

ParseFile reads a custom-validator file (the `--from <path>` shape) and returns the validator block. The file is plain YAML with the same fields as a recipe's frontmatter; the markdown body is not part of the contract for `--from <path>`.

Jump to

Keyboard shortcuts

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