plan

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plan orders the cases of a run (FR-ORDER): resource groups follow the dependency graph of their bindings, cases within a group follow their rank (create, read, list, update, 4xx, authentication, delete; the operations of Options.LastInTag after all but the deletes), DELETE cases of groups that others depend on (or of all groups with DeleteLast) run after all groups, in reverse order. All regular cases of the run come first, then the 4xx/5xx examples, conflict and authentication cases, and the generated not-found cases at the very end.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLastInTag

func CheckLastInTag(s *spec.Spec, ids []string) error

CheckLastInTag reports operations of LastInTag the spec does not have.

Types

type Options

type Options struct {
	// Tags is Config.Tags: the order of the groups where bindings allow it.
	Tags []string
	// DeleteLast runs the DELETE cases of every group after all other
	// cases, in reverse group order, instead of only for groups that others
	// depend on.
	DeleteLast bool
	// LastInTag are operations (operationId or "METHOD /path") whose cases
	// run after all other cases of their group, whatever their method, in
	// the order listed; only the DELETE cases of the group follow them.
	LastInTag []string
}

Options influence the order.

type Plan

type Plan struct {
	Segments []Segment
	// Deps lists the producer cases each case needs a value from.
	Deps map[*cases.Case][]*cases.Case
	// Precondition marks cases that are only run because a selected case
	// needs their bindings (FR-GO-02).
	Precondition map[*cases.Case]bool
	Groups       []string // group order
}

Plan is the execution order of a run.

func Build

func Build(all []*cases.Case, selected func(*cases.Case) bool, set *bind.Set, opt Options) (*Plan, error)

Build plans the cases. all must contain every case of the spec in the order of cases.Build; selected tells which of them the user asked for. Unselected cases are only kept if a selected case depends on them.

func (*Plan) Cases

func (p *Plan) Cases() []*cases.Case

Cases returns all planned cases in execution order.

type Segment

type Segment struct {
	Group string
	Cases []*cases.Case
	First bool // first segment of the group: BeforeGroup runs before it
	Last  bool // last segment of the group: AfterGroup runs after it
}

Segment is a consecutive part of a group's cases.

Jump to

Keyboard shortcuts

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