Help us shape the future of Go! Take the 2026 Go Developer Survey

sites

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sites enumerates where things live in loaded collections: root node lists, hook scopes and steps, template sites, written variables and statically resolved request versions. validate and analysis share it so they agree on what a template reads and where it is written.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AncestorFolders

func AncestorFolders(c model.Collection, r model.Request) []model.Folder

AncestorFolders are the _folder.yaml folders on the way down to r.

func GeneratedVars

func GeneratedVars(n model.Node) map[string]bool

GeneratedVars are the variables a node fills with generated values: fresh data, not taken from another step.

func HasParam

func HasParam(n model.Node, key string) bool

HasParam reports whether n sets the parameter key.

func OwnWrites

func OwnWrites(n model.Node) []string

OwnWrites are the targets one node writes itself.

func ParamValue

func ParamValue(n model.Node, key string) any

ParamValue is the value of parameter key, or nil.

func ParseLabel

func ParseLabel(s string) *version.Label

ParseLabel parses a version label; empty or invalid labels give nil.

func ResolvedVersion

func ResolvedVersion(r model.Request, pinned, prefer string) (model.RequestVersion, bool)

ResolvedVersion is the version a node runs without a run preference.

func SpecsByType

func SpecsByType() map[model.NodeType]nodes.Spec

SpecsByType indexes the node registry (the single source of parameter rules, plan Decision 17).

func VisibleDescendants

func VisibleDescendants(n model.Node) map[string]bool

VisibleDescendants are the nodes inside n readable after it: not those of repeated bodies (batch, run_till), which are read through results.

func WrittenVars

func WrittenVars(list []model.Node) map[string]bool

WrittenVars is every variable name written anywhere in a node list, batch bodies included.

Types

type Located

type Located[T any] struct {
	File  string
	Path  string
	Value T
}

Located is any value together with the file and YAML path it came from.

func AllNodes

func AllNodes(c model.Collection) []Located[model.Node]

AllNodes flattens NodeLists into individual nodes with their paths.

func HookScopes

func HookScopes(c model.Collection) []Located[model.Hooks]

HookScopes lists every place hooks can be attached, with the YAML path of the mapping that holds the "hooks" key.

func HookSteps

func HookSteps(c model.Collection) []Located[model.HookStep]

HookSteps lists every hook step in the collection.

type NodeList

type NodeList = Located[[]model.Node]

NodeList is a list of sibling nodes and the YAML path of the list.

func ChildLists

func ChildLists(n model.Node, p string) []NodeList

ChildLists returns the node lists directly inside n (body, branches, then, else, cases); p is n's YAML path. File is left empty.

func ExpandLists

func ExpandLists(l NodeList) []NodeList

ExpandLists returns l and every node list nested inside its nodes.

func NodeLists

func NodeLists(c model.Collection) []NodeList

NodeLists returns every node list in the collection, top-level and nested inside containers.

func RootLists

func RootLists(c model.Collection) []NodeList

RootLists returns the top-level node lists: each flow's nodes and each hook step's inline nodes. Node ids must be unique within one root.

type Site

type Site struct {
	File, Path, Field, Src string
	Expression             bool   // a bare expression (assert check, when), not a {{…}} template
	Node                   string // the node the site belongs to; empty for flow and version sites
}

Site is one template or expression and where it is written.

func FlowTemplates

func FlowTemplates(f model.Flow) []Site

FlowTemplates are a flow's own templates: input defaults, outputs and the run-till condition.

func NodeTemplates

func NodeTemplates(n Located[model.Node]) []Site

NodeTemplates covers when, a request node's with values, and the template parameters of inline node types.

func Templates

func Templates(c model.Collection) []Site

Templates lists every template and expression in a collection.

func VersionTemplates

func VersionTemplates(file string, v model.RequestVersion) []Site

VersionTemplates are a request version's templates: url, query, headers, body and asserts.

Jump to

Keyboard shortcuts

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