validate

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 39 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 validate checks SpecArch specifications and implementation files: the JSON Schema of their kind first, then the rules a schema cannot express.

Index

Constants

View Source
const (
	RootFile             = spec.RootFile
	ImplementationSuffix = spec.ImplementationSuffix
)
View Source
const (
	OutcomePass     = "pass"               // an example whose expected value the formula gives
	OutcomeFail     = "fail"               // an example whose expected value it does not give
	OutcomeError    = "cannot be computed" // the formula fails on the inputs
	OutcomeUnread   = "cannot be read"     // an input or the expected value does not fit its field
	OutcomeComputed = "computed"           // given inputs, which have no expected value
)

The outcomes of an evaluation of specarch try.

View Source
const IdiomSuffix = ".specarch-idiom.yaml"

IdiomSuffix ends the name of every idiom file.

Variables

View Source
var Rules = []Rule{}/* 192 elements not displayed */

Rules lists every rule, in the order of the design's Rule enum.

SecurityRules are the design security rules, in the order of the design's Rule enum. The problems file's SARIF tags each with security.

Functions

func DeriveWrites added in v0.6.0

func DeriveWrites(d Diagnostic) bool

DeriveWrites says whether a diagnostic is a missing test that specarch derive writes, an error in a 0.2 file that derive is run to settle.

func Errors

func Errors(ds []Diagnostic) int

Errors counts the diagnostics that make a file invalid.

func GivenDependencies added in v1.0.0

func GivenDependencies(s *spec.Spec, given Given) map[string]*spec.Spec

GivenDependencies are the specifications of the run that the dependencies of a specification name, by the dependency's name: those given once under the name the dependency's specification gives.

func Heard added in v1.6.0

func Heard(s *spec.Spec, role string) bool

Heard reports whether some record beside the specification, or the specification itself, shows that role was heard, as the rule unheard reads it (ADR-239).

func Locate added in v0.6.0

func Locate(root *yaml.Node, tokens []string) (start, value *yaml.Node, whole bool)

Locate follows a pointer from root. It returns where the deepest entry reached starts (its key, or its item in a list), its value, and whether the whole pointer was reached. For the empty pointer both are the root.

func Positions added in v0.7.2

func Positions(root *yaml.Node, files map[*yaml.Node]string, file string) map[string]Position

Positions maps the pointer of every node of a tree to its position: the root is "/", as the problems file writes it, and a key a mapping repeats is left out after its first entry, as the document's values leave it out. files names the file of each node; a node it does not name is in file.

func ProblemMissing added in v1.6.0

func ProblemMissing(root *yaml.Node) bool

ProblemMissing reports whether a specification has requirements and no problem (ADR-244), on a meta-model whose schema has the key, with no open must question blocking the problem. The validator warns of it on the full profile; specarch gaps --next asks for it first on every profile.

func Questions added in v0.2.0

func Questions(root *yaml.Node) (must, should, could int)

Questions counts the open questions of a specification by priority: must, should and could, in that order.

func ShippedIdioms added in v0.4.0

func ShippedIdioms() map[string]Idiom

ShippedIdioms are the idioms this build ships, by name.

func Sort

func Sort(ds []Diagnostic)

Sort orders diagnostics by file, line, column, path, rule, message and id.

func SpecName added in v0.7.0

func SpecName(root *yaml.Node) string

SpecName is a specification's info.name, or "".

func StakeholdersUnconfirmed added in v1.5.0

func StakeholdersUnconfirmed(root *yaml.Node) bool

StakeholdersUnconfirmed reports whether a specification's stakeholder list is unconfirmed as the validator sees it (ADR-234). The documents, the site and approve show the banner and the warning on the same condition, so one gap gets one mark.

func StatePaths added in v0.3.0

func StatePaths(root *yaml.Node) map[string][]string

StatePaths lists, per entity with a state machine, its paths from an initial to a terminal state, named as a test covers them.

func Tokens added in v0.6.0

func Tokens(ptr string) []string

Tokens splits a JSON pointer into its unescaped tokens; none for "/".

func TriedHere added in v1.3.0

func TriedHere(d Diagnostic, t Evaluated) bool

TriedHere reports whether a diagnostic is one that specarch try says in its own lines: a worked example it evaluated that does not hold or cannot be computed. An example it did not evaluate keeps its line.

Types

type CaseTests added in v1.5.0

type CaseTests struct {
	Subject  string // "operation createItem"
	Case     string // "name longer than 40 characters"
	Scenario string // golden or red
	Tests    []string
}

CaseTests is a derived case a test must cover, or one a test covers although it was left out, with the tests that cover it by name, sorted.

func CoveredCases added in v1.5.0

func CoveredCases(root *yaml.Node, given Given) []CaseTests

CoveredCases lists the derived cases of a specification that are chosen or that a test covers, by subject in document order, each with the tests that cover it; a chosen case no test covers has none. specarch compare counts the results of an implementation per case by them (ADR-232).

type Chain added in v0.7.2

type Chain struct {
	Operation string
	Hops      []Hop
}

A Chain is one way a call reaches an operation, from the edge on, as the induction through calls finds it across the modules given together.

func Chains added in v0.7.2

func Chains(s *spec.Spec, given Given) []Chain

Chains are the chains that reach each operation of a specification with a via, found across the specifications given with it; nil when no module that a via names is given (ADR-111).

type Diagnostic

type Diagnostic struct {
	File     string
	Line     int
	Column   int
	Severity Severity
	Path     string
	Rule     Rule
	Message  string
	// ID names what is wrong, not where it is printed (ADR-065): set by
	// a Placer.
	ID string
	// Detail is the YAML parser's own message for a yaml_syntax error,
	// which differs between parsers; it is printed on standard error, never
	// in the problem line (ADR-177).
	Detail string
}

Diagnostic is one problem in one file.

func CheckEstate added in v0.7.0

func CheckEstate(e *Estate, specs map[string]*spec.Spec) []Diagnostic

CheckEstate checks an estate against the specifications read in the run, by their folder: that each module is where it is listed, named and at the version the estate lists, and that no module's calls come back to it through the others.

func CheckImplementation

func CheckImplementation(path string, data []byte, load Loader) []Diagnostic

CheckImplementation checks one implementation file given on its own. The specification it implements is loaded through load.

func CheckNamed

func CheckNamed(path string) []Diagnostic

CheckNamed reports a file given by name that is neither a root file nor an implementation file.

func CheckSpec

func CheckSpec(s *spec.Spec, given ...Given) []Diagnostic

CheckSpec runs every check on a specification and on the implementation files inside it, and returns the diagnostics to report, sorted. What an open question covers is left out; CheckSpecCovered returns it too.

func CheckSpecCovered added in v0.2.0

func CheckSpecCovered(s *spec.Spec, given ...Given) (kept, covered []Diagnostic)

CheckSpecCovered runs every check and returns the diagnostics to report and, apart, the ones an open must question covers (see Covered), both sorted.

func Covered added in v0.2.0

func Covered(ds []Diagnostic, root *yaml.Node) (kept, covered []Diagnostic)

Covered splits the diagnostics into the ones to report and the ones an open must question covers: a required key missing at or under a pointer the question blocks, the warnings about that element, the problem a response must name once problem types are declared when the question blocks that problem, a permission no role grants when the question blocks that permission, and the one-namespace error at a schema or a view named like an entity, or a schema like a view, when the question blocks that schema or view. A pointer to an element covers everything missing at or under it, whether the element is written out in part, such as a field with its width and no type, or known only by name, an empty mapping. A pointer to a key that is not there covers that one key. A wrong value next to the gap stays an error. root is the merged specification.

func GeneratorReferences added in v0.7.0

func GeneratorReferences(s *spec.Spec, target string, given Given) []Diagnostic

GeneratorReferences are the errors a code target meets in the references of a specification whose specification the run does not give, since generate reads the specifications given and no other: a value typed by another specification's element (an entity's or view's field for sql, any for the other targets), and for the UI targets a list page or picker that reads another specification's list. A relation's target is not among them: its via field is this specification's. A reference into a specification given, as an estate gives its modules, is the plug-in's to write (ADR-184).

func LayoutProblems added in v0.7.2

func LayoutProblems(s *spec.Spec) []Diagnostic

LayoutProblems are the problems found while reading a specification (a file not where the tree puts it, a section in the wrong stage, a file that did not parse), placed as the problems file places them.

func ReadProblems added in v0.7.2

func ReadProblems(path, dir string, doc *source.Doc) []Diagnostic

ReadProblems are the problems found while reading one file on its own, such as an implementation file: what of its YAML does not parse. Their ids name the file from dir.

func (Diagnostic) DetailLine added in v0.7.4

func (d Diagnostic) DetailLine() string

DetailLine is the line that prints the YAML parser's own message on standard error, after the fixed marker "yaml parser"; empty when there is none.

func (Diagnostic) String

func (d Diagnostic) String() string

String is the problem line: file:line:column: severity: /yaml/path: rule: message [id].

type Draft added in v0.3.0

type Draft struct {
	Name      string   // the test folder's name, the one the validator suggests
	Subject   string   // how a message names the subject: "operation createLoan"
	Text      string   // the test.yaml
	BlockedBy []string // the must or should questions that hold up the subject
	// Collision says why the draft cannot be written under its name: another
	// draft has the same name, or a test of another subject already has it.
	Collision string
	// Renamed says why the name has a suffix, when another subject's name
	// gives the same test name once both are valid names.
	Renamed string
}

Draft is one test specarch derive writes: a derived case no test covers, as the text of its test.yaml.

func Drafts added in v0.3.0

func Drafts(root *yaml.Node, given Given) []Draft

Drafts lists the tests a valid specification implies and has not got: the success test of every subject without a golden test, and every chosen derived case no test covers, in the order the warnings name them. The cases read the identity module among the specifications given.

type Estate added in v0.7.0

type Estate struct {
	Path    string
	Root    *yaml.Node // nil when nothing of the file could be read
	Modules []Module   // in the order the file lists them
	// contains filtered or unexported fields
}

An Estate is an estate file as read from disk: the modules' specifications it lists and pins (ADR-113).

func LoadEstate added in v0.7.0

func LoadEstate(path string) (*Estate, error)

LoadEstate reads an estate file. Only a file that cannot be read is an error; what is wrong inside it is reported by CheckEstate.

func (*Estate) Roots added in v0.7.0

func (e *Estate) Roots() []string

Roots are the folders of the modules whose specification is there: the ones the estate gives the run to check with it.

type Evaluated added in v1.4.0

type Evaluated interface {
	// contains filtered or unexported methods
}

Evaluated is what specarch try evaluated, an algorithm's examples or an operation's mapping examples, for TriedHere.

type Evaluation added in v1.3.0

type Evaluation struct {
	Number   int        `json:"number,omitempty"` // the example's place, from 1; 0 for given inputs and a rule's example
	Rule     int        `json:"rule,omitempty"`   // a decision table's rule whose example this is, from 1
	Name     string     `json:"name"`             // the example's name, "" for one with none
	Outcome  string     `json:"outcome"`
	Inputs   []TryInput `json:"inputs"`
	Unread   []string   `json:"unread,omitempty"` // why an input or the expected value cannot be read
	Steps    []TryStep  `json:"steps"`
	Result   *string    `json:"result,omitempty"`
	Expected *string    `json:"expected,omitempty"`
	Error    string     `json:"error,omitempty"`
	// A mapping example's answer and each field sent or kept (ADR-207).
	Answer []TryInput   `json:"answer,omitempty"`
	Fields []TriedField `json:"fields,omitempty"`
	// contains filtered or unexported fields
}

Evaluation is one evaluation of specarch try: a worked example, or the inputs given on the command line.

type Fill added in v1.5.0

type Fill struct {
	Name    string   // the test's name
	Subject string   // how a message names the subject
	Lines   []string // the lines to add, or none
	Reason  string   // why nothing is added, when the design fixes data but it cannot be added
}

Fill is the structured data derive --fill adds to a test that has none: the lines of its fixture, input and expect, or, when it adds nothing, why.

func Fills added in v1.5.0

func Fills(root *yaml.Node, given Given) []Fill

Fills lists, for every test with none of fixture, input and expect and not marked notApplicable, the data its cases draft: the data of the one case it covers, or of the success when a golden test covers none. A test of several cases is filled when the data of one of them holds what the others give, as not found memberId does response 404; otherwise, its cases drafting different data or one of them drafting none, or only a status, it is left as it is with that reason, which names why such a case keeps its status alone. A test whose cases the design fixes nothing about is not listed.

type Given added in v0.7.0

type Given map[string][]*spec.Spec

Given is the specifications given together in one run, by their info.name; a specification without one is not listed (ADR-112).

func NewGiven added in v0.7.0

func NewGiven(specs []*spec.Spec) Given

NewGiven lists the specifications by name.

type Hop added in v0.7.2

type Hop struct {
	Module, Operation, Token, Proof string
}

A Hop is one operation of a delegation chain: the module and the operation, the token it accepts, and the proof kind its module presents to the next hop as the client the next hop's via names ("" for the last).

type Idiom added in v0.4.0

type Idiom struct {
	Path string // idioms/<concern>/<name>.specarch-idiom.yaml for a shipped one, the file for a project's
	Root *yaml.Node
}

Idiom is one idiom file, parsed.

func (Idiom) Name added in v0.4.0

func (i Idiom) Name() string

Name is the idiom's name.

func (Idiom) Version added in v0.4.0

func (i Idiom) Version() string

Version is the idiom's version.

type IdiomUse added in v0.4.0

type IdiomUse struct {
	Name, Version string
	As            string   // shipped, overridden, project or excluded
	Parts         []string // for an override: the parts it replaces, or every part
	From          string   // for an override: the shipped version it was copied from
	Override      string   // for an override: its file
	Why           string   // for an override or an exclusion: its reason
}

IdiomUse is one idiom as an implementation file uses it.

func IdiomUses added in v0.4.0

func IdiomUses(file string, root *yaml.Node, s *spec.Spec) []IdiomUse

IdiomUses lists the idioms an implementation file uses, in name order: every shipped idiom and every one of the project's own that applies, each as shipped, overridden or the project's, and every idiom it excludes. s is the specification it implements.

func IdiomUsesWith added in v1.0.0

func IdiomUsesWith(file string, root *yaml.Node, s *spec.Spec, always ...string) []IdiomUse

IdiomUsesWith is IdiomUses with the named idioms used whether or not the specification uses the keywords they read, as an output that follows an idiom's shape without the keyword needs them: the ui target's server routes answer a list in the paginated-list idiom's envelope whether or not the design has a listOf. An exclusion and an override in the file apply to them as to any other.

type Kind

type Kind int

Kind is the kind of a SpecArch file, read from its name.

const (
	KindNone Kind = iota
	KindDesign
	KindImplementation
	KindRecord
	KindIdiom
	KindEstate
)

func KindOf

func KindOf(name string) Kind

KindOf tells the kind of a file from its name: the root file of a specification, an implementation file, an estate, or none of them.

type LeftOut added in v0.3.0

type LeftOut struct {
	Subject  string // "operation createItem"
	Case     string // "name longer than 40 characters"
	Scenario string // golden or red
	Reason   string
}

LeftOut is a derived case of rank other that no test covers: the test plan lists it with the reason it was left out.

func LeftOutCases added in v0.3.0

func LeftOutCases(root *yaml.Node, given Given) []LeftOut

LeftOutCases lists the derived cases of a valid specification that are not chosen and that no test covers, by subject in document order.

type Loader

type Loader func(dir string) *spec.Spec

Loader reads the specification rooted at a folder: the implementation file names it under implements.

type ModelReference added in v0.7.2

type ModelReference struct {
	From    string
	To      string
	Through string
}

A ModelReference is one resolved reference of a specification: the pointer of the entry that refers, the pointer of the element it names, and the keyword that made it (ADR-138).

func ImplementationReferences added in v0.7.2

func ImplementationReferences(impl, design *yaml.Node) []ModelReference

ImplementationReferences lists the references of an implementation file that resolve in the specification it implements: each design pointer under a layout entry's implements and a mapping's design, and each dependency of the design a server or an external step names by its key, with the keyword that holds it.

func ModelReferences added in v0.7.2

func ModelReferences(root *yaml.Node) []ModelReference

ModelReferences lists every reference of a specification that resolves to an element of it, in document order: a $ref that is a pointer into the specification, and a name under one of the reference keywords that names an element. A reference that does not resolve is the validator's problem and is left out; so is one into another specification.

type Module added in v0.7.0

type Module struct {
	Key      string
	Location string // the folder of its specification, from the estate's folder; "" when the entry gives none
	Version  string
	// contains filtered or unexported fields
}

A Module is one module an estate lists.

func (Module) Description added in v0.7.0

func (m Module) Description() string

Description is the estate's description of the module.

func (Module) LocationText added in v0.7.0

func (m Module) LocationText() string

LocationText is the module's location as the estate writes it.

type PairContrast added in v0.5.0

type PairContrast struct {
	Text, Background, Use string
	Ratios                []string
}

PairContrast is a pair of the theme with its contrast in each mode, the default first, written to two decimals; a mode in which a colour cannot be read has "".

func ThemeContrasts added in v0.5.0

func ThemeContrasts(root *yaml.Node) ([]PairContrast, []string)

ThemeContrasts are the contrasts of the theme's pairs, for the documents, with the names of the modes after the default.

type Placer added in v0.6.0

type Placer struct {
	Root     *yaml.Node
	Files    map[*yaml.Node]string
	RootFile string
	Dir      string
	// contains filtered or unexported fields
}

Placer gives diagnostics their column and their id (ADR-065). Root and Files are the merged specification and the file of each of its nodes; a pointer that does not lead to a node of the diagnostic's file there is followed in that file parsed on its own. Dir is the folder ids name files from.

func SpecPlacer added in v0.6.0

func SpecPlacer(s *spec.Spec) *Placer

SpecPlacer places the diagnostics of a specification: ids name files from the specification's folder.

func (*Placer) Place added in v0.6.0

func (p *Placer) Place(ds []Diagnostic)

Place sets the column of each diagnostic that has none and the id of every one, telling apart the ids one rule reports at one pointer of one file.

func (*Placer) TreeOf added in v0.6.0

func (p *Placer) TreeOf(file string, tokens []string) *yaml.Node

TreeOf is the tree a pointer into file is into: the merged specification when the pointer leads there to a node of that file, and otherwise the file parsed on its own (an implementation file, a record, or a fragment the specification could not merge).

type Position added in v0.7.2

type Position struct {
	File   string
	Line   int
	Column int
}

A Position is where a node of the model starts: its key in a mapping, or the item itself in a list, in the file it came from (ADR-138).

type Reference added in v0.7.0

type Reference struct {
	Path          string // where it stands in this specification
	Line          int
	Text          string // as written
	Dependency    string
	Specification string // the dependency's specification
	Version       string // the dependency's version
	Waits         string // why it is not resolved
}

A Reference names an element of another specification through a dependency: <dependency>#/<pointer>.

func References added in v0.7.0

func References(s *spec.Spec, given Given) []Reference

References lists the references of a specification that are not resolved: the specification they name is not given, or the element is blocked there by a must question. A wrong reference is an error and is not listed.

type RoleColumn added in v0.7.2

type RoleColumn struct {
	Name  string
	Cells map[string]string
}

A RoleColumn is one holder of a module's permissions in the identity module: a role, or a client with roles named with its kind, and the cell for each permission it reaches, yes or the clients a through narrows it to.

func ReferencedGrants added in v0.7.2

func ReferencedGrants(s *spec.Spec, given Given) []RoleColumn

ReferencedGrants are the roles and clients with roles of the identity module that reach a permission of this specification, in the identity module's order; nil when the identity module is not given (ADR-107).

type Rule

type Rule string

Rule names one check. The values are the Rule enum of spec/specarch.specarch-design.yaml.

const (
	RuleFileKind                Rule = "file_kind"
	RuleYAMLSyntax              Rule = "yaml_syntax"
	RuleUnquotedDate            Rule = "unquoted_date"
	RuleDuplicateKey            Rule = "duplicate_key"
	RuleSchema                  Rule = "schema"
	RuleStackKey                Rule = "stack_key"
	RuleDesignKey               Rule = "design_key"
	RuleRefType                 Rule = "ref_type"
	RuleRelationTarget          Rule = "relation_target"
	RuleRelationVia             Rule = "relation_via"
	RuleReference               Rule = "reference"
	RuleModule                  Rule = "module"
	RuleField                   Rule = "field"
	RuleStateField              Rule = "state_field"
	RuleStateValue              Rule = "state_value"
	RuleTrigger                 Rule = "trigger"
	RuleRequirement             Rule = "requirement"
	RuleEmits                   Rule = "emits"
	RuleDependency              Rule = "dependency"
	RuleIntegration             Rule = "integration"
	RuleChannel                 Rule = "channel"
	RuleIdempotencyKey          Rule = "idempotency_key"
	RuleValidity                Rule = "validity"
	RuleTimeZone                Rule = "time_zone"
	RuleSession                 Rule = "session"
	RuleGuard                   Rule = "guard"
	RuleOperation               Rule = "operation"
	RulePage                    Rule = "page"
	RuleAlgorithm               Rule = "algorithm"
	RuleDecision                Rule = "decision"
	RuleEnumValue               Rule = "enum_value"
	RulePathParameter           Rule = "path_parameter"
	RuleDuplicateOperation      Rule = "duplicate_operation"
	RulePermissionUndeclared    Rule = "permission_undeclared"
	RulePermissionUngranted     Rule = "permission_ungranted"
	RuleSeparationOfDuties      Rule = "separation_of_duties"
	RuleImplies                 Rule = "implies"
	RuleExpressionSyntax        Rule = "expression_syntax"
	RuleExpressionName          Rule = "expression_name"
	RuleExpressionType          Rule = "expression_type"
	RuleExampleInput            Rule = "example_input"
	RuleExampleExpected         Rule = "example_expected"
	RuleExampleMismatch         Rule = "example_mismatch"
	RuleExampleError            Rule = "example_error"
	RuleDecisionTable           Rule = "decision_table"
	RuleTableOverlap            Rule = "table_overlap"
	RuleTableGap                Rule = "table_gap"
	RuleImplements              Rule = "implements"
	RuleDesignRef               Rule = "design_ref"
	RuleTestSubject             Rule = "test_subject"
	RuleTestCase                Rule = "test_case"
	RuleTestGoldenMissing       Rule = "test_golden_missing"
	RuleTestRedMissing          Rule = "test_red_missing"
	RuleTestCaseMissing         Rule = "test_case_missing"
	RuleSuite                   Rule = "suite"
	RuleTestData                Rule = "test_data"
	RuleChangeLog               Rule = "change_log"
	RuleUnsafeInteger           Rule = "unsafe_integer"
	RuleLayout                  Rule = "layout"
	RuleDependsOn               Rule = "depends_on"
	RuleServer                  Rule = "server"
	RuleLink                    Rule = "link"
	RuleLinkMissing             Rule = "link_missing"
	RuleNeed                    Rule = "need"
	RuleStakeholder             Rule = "stakeholder"
	RuleStakeholdersUnconfirmed Rule = "stakeholders_unconfirmed"
	RuleSource                  Rule = "source"
	RuleSourceClause            Rule = "source_clause"
	RuleEnvironment             Rule = "environment"
	RuleSetting                 Rule = "setting"
	RuleSecretValue             Rule = "secret_value"
	RuleMonitor                 Rule = "monitor"
	RuleRecordName              Rule = "record_name"
	RuleRecordRef               Rule = "record_ref"
	RuleChangeApplied           Rule = "change_applied"
	RuleChangeDecision          Rule = "change_decision"
	RuleChangeAnswered          Rule = "change_answered"
	RuleEnvironmentTrace        Rule = "environment_trace"
	RuleDefectTest              Rule = "defect_test"
	RuleDefectDuplicate         Rule = "defect_duplicate"
	RuleIncidentLink            Rule = "incident_link"
	RuleIdeaDecision            Rule = "idea_decision"
	RuleIdeaQuestion            Rule = "idea_question"
	RuleEvidence                Rule = "evidence"
	RuleRecordCited             Rule = "record_cited"
	RuleUnheard                 Rule = "unheard"
	RuleApprovalSession         Rule = "approval_session"
	RuleTestUnmapped            Rule = "test_unmapped"
	RuleCommissioningRecord     Rule = "commissioning_record"
	RuleReleaseContents         Rule = "release_contents"
	RuleReleaseBump             Rule = "release_bump"
	RuleReleaseVersion          Rule = "release_version"
	RuleNeedUnrefined           Rule = "need_unrefined"
	RuleAcceptanceMissing       Rule = "acceptance_missing"
	RuleRequirementUnsatisfied  Rule = "requirement_unsatisfied"
	RuleRequirementUnverified   Rule = "requirement_unverified"
	RuleQuestionBlock           Rule = "question_block"
	RuleQuestionStage           Rule = "question_stage"
	RuleQuestionAnswered        Rule = "question_answered"
	RuleOriginCitation          Rule = "origin_citation"
	RuleOriginReason            Rule = "origin_reason"
	RuleOriginDecision          Rule = "origin_decision"
	RuleOriginMissing           Rule = "origin_missing"
	RuleIdiomUnknown            Rule = "idiom_unknown"
	RuleIdiomPartUnknown        Rule = "idiom_part_unknown"
	RuleIdiomOverrideReason     Rule = "idiom_override_reason"
	RuleIdiomStack              Rule = "idiom_stack"
	RuleIdiomVersionBehind      Rule = "idiom_version_behind"
	RuleIdiomContract           Rule = "idiom_contract"
	RuleSensitivityExposed      Rule = "sensitivity_exposed"
	RuleAtRest                  Rule = "at_rest"
	RuleAudited                 Rule = "audited"
	RuleListOf                  Rule = "list_of"
	RuleLimits                  Rule = "limits"
	RuleProblem                 Rule = "problem"
	RuleJob                     Rule = "job"
	RuleGateway                 Rule = "gateway"
	RuleMenu                    Rule = "menu"
	RuleView                    Rule = "view"
	RuleFlow                    Rule = "flow"
	RuleRoleHome                Rule = "role_home"
	RuleNavigation              Rule = "navigation"
	RuleState                   Rule = "state"
	RuleAccessibility           Rule = "accessibility"
	RuleTheme                   Rule = "theme"
	RuleWorkflow                Rule = "workflow"
	RulePicker                  Rule = "picker"
	RuleAction                  Rule = "action"
	RuleFormField               Rule = "form_field"
	RuleValueObject             Rule = "value_object"
	RuleValueObjectUnchecked    Rule = "value_object_unchecked"
	RuleWireName                Rule = "wire_name"
	RuleOutputFolder            Rule = "output_folder"
	RuleDocumentFormat          Rule = "document_format"
	RuleMetaModelVersion        Rule = "meta_model_version"
	RuleMetaModelDeprecated     Rule = "meta_model_deprecated"
	RuleAudience                Rule = "audience"
	RuleQuestionOpened          Rule = "question_opened"
	RuleHandover                Rule = "handover"
	RuleBuildTask               Rule = "build_task"
	RuleRequestBodyOpen         Rule = "request_body_open"
	RuleSuccessResponseMissing  Rule = "success_response_missing"
	RuleMiddleware              Rule = "middleware"
	RuleMiddlewareMissing       Rule = "middleware_missing"
	RuleHandlerSource           Rule = "handler_source"
	RuleHandshake               Rule = "handshake"
	RuleStream                  Rule = "stream"
	RuleCallerProperty          Rule = "caller_property"
	RuleRowPolicies             Rule = "row_policies"
	RuleTenant                  Rule = "tenant"
	RuleReservedName            Rule = "reserved_name"
	RuleClient                  Rule = "client"
	RuleClientUnused            Rule = "client_unused"
	RuleSoftwareVersion         Rule = "software_version"
	RuleThrough                 Rule = "through"
	RuleCallers                 Rule = "callers"
	RuleProof                   Rule = "proof"
	RuleToken                   Rule = "token"
	RuleClaim                   Rule = "claim"
	RuleVia                     Rule = "via"
	RuleTokenAudience           Rule = "token_audience"
	RuleSecurityEvents          Rule = "security_events"
	RuleSignIn                  Rule = "sign_in"
	RuleExitCode                Rule = "exit_code"
	RuleDecisionCycle           Rule = "decision_cycle"
	RuleDecisionSuperseded      Rule = "decision_superseded"
	RuleProfile                 Rule = "profile"
	RuleProcess                 Rule = "process"
	RuleRoute                   Rule = "route"
	RuleTechnologyUnjustified   Rule = "technology_unjustified"
	RuleGoal                    Rule = "goal"
	RuleQualityGoal             Rule = "quality_goal"
	RuleProblemMissing          Rule = "problem_missing"
	RuleGoalUnmeasured          Rule = "goal_unmeasured"
	RuleGoalUnserved            Rule = "goal_unserved"
	RuleNeedWithoutGoal         Rule = "need_without_goal"
	RuleScopeConflict           Rule = "scope_conflict"
	RuleQualityGoalRank         Rule = "quality_goal_rank"
	RuleWorkPackageCycle        Rule = "work_package_cycle"
	RuleWorkPackageOrder        Rule = "work_package_order"
	RuleWorkPackageOverlap      Rule = "work_package_overlap"
	RuleWorkPackageRelease      Rule = "work_package_release"
	RuleWorkPackageNotReady     Rule = "work_package_not_ready"
	RuleWorkPackageUnverified   Rule = "work_package_unverified"
	RuleWorkPackageUnconfigured Rule = "work_package_unconfigured"
	RuleObjectUnscoped          Rule = "object_unscoped"
	RuleInternalKeyExposed      Rule = "internal_key_exposed"
	RuleRefusalRevealsRecord    Rule = "refusal_reveals_record"
	RuleQueryFromCaller         Rule = "query_from_caller"
	RuleDutiesUnseparated       Rule = "duties_unseparated"
	RuleSecretUnprotected       Rule = "secret_unprotected"
	RuleAuditNotAppendOnly      Rule = "audit_not_append_only"
)

func ApprovalSession added in v1.6.0

func ApprovalSession(s *spec.Spec, id, role string) (Rule, string)

ApprovalSession is the problem with id as the session of an approval by role, as validate reports it at the record's session, or "" with no rule when the record exists and lists the role (ADR-239).

type Severity

type Severity string

Severity says whether a diagnostic makes the file invalid.

const (
	// Error makes the file invalid.
	Error Severity = "error"
	// Warning is printed but leaves the file valid: missing test scenarios,
	// change-log phrases, traceability gaps and incidents left unexplained.
	Warning Severity = "warning"
)

type Tried added in v1.3.0

type Tried struct {
	Algorithm   string       `json:"algorithm"`
	Formula     string       `json:"formula"`             // "" for a decision table
	HitPolicy   string       `json:"hitPolicy,omitempty"` // a decision table's
	Rules       int          `json:"rules,omitempty"`     // how many rules a decision table has
	File        string       `json:"file"`
	Evaluations []Evaluation `json:"evaluations"`
}

Tried is what specarch try found for one algorithm.

func Try added in v1.3.0

func Try(s *spec.Spec, algorithm, example string, given *yaml.Node) (*Tried, string)

Try evaluates an algorithm of a specification with the validator's evaluator, on each worked example, on the one named example, or once on given inputs, a mapping written as an example's inputs are (ADR-195). It returns a refusal when the algorithm, its formula or the example is not there to evaluate. The specification is validated apart.

type TriedCall added in v1.4.0

type TriedCall struct {
	Call        string       `json:"call"`      // the call as the derived cases name it
	Reference   string       `json:"reference"` // the calls entry's call
	File        string       `json:"file"`
	Evaluations []Evaluation `json:"evaluations"`
}

TriedCall is what specarch try found for the mapping examples of one call of an operation.

type TriedField added in v1.4.0

type TriedField struct {
	Direction  string    `json:"direction"` // sent or kept
	Field      string    `json:"field"`
	Expression string    `json:"expression"`
	Steps      []TryStep `json:"steps"`
	Outcome    string    `json:"outcome"`
	Result     *string   `json:"result,omitempty"`
	Expected   *string   `json:"expected,omitempty"`
	Error      string    `json:"error,omitempty"`
}

TriedField is one field of a mapping example as specarch try evaluated it: sent, a field of their request from send, or kept, a field of our record from receive, with the steps of its expression.

type TriedOperation added in v1.4.0

type TriedOperation struct {
	Operation string      `json:"operation"`
	Calls     []TriedCall `json:"calls"`
}

TriedOperation is what specarch try found for an operation: each of its calls whose mapping has examples (ADR-207).

func TryOperation added in v1.4.0

func TryOperation(s *spec.Spec, name, example string) (*TriedOperation, string, bool)

TryOperation evaluates the mapping examples of an operation's calls, or the one example named, as Try evaluates an algorithm's (ADR-207). It returns false when the specification has no operation of that name, and a refusal when an algorithm has the name too or the operation has no mapping example.

type TryInput added in v1.3.0

type TryInput struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

TryInput is one input of an evaluation, as a worked example writes it.

type TryStep added in v1.3.0

type TryStep struct {
	Expression string `json:"expression"`
	Line       int    `json:"line"`
	Column     int    `json:"column"`
	Value      string `json:"value"`
}

TryStep is one operation or call of a formula as it was computed: the sub-expression in the subset's own form, its line and column in the file as a problem line counts them (an operator's own place, a call's name), and the value it gave, as a worked example writes it.

type WorkPackage added in v1.7.0

type WorkPackage struct {
	Path                                        string // the record's file
	ID, Title, Release, Status, AssignedTo, Why string
	Requirements, After                         []string
	// EstimatedHours and SpentHours are the effort as written, "" when
	// left out.
	EstimatedHours, SpentHours string
	// NotReady is what keeps the package from starting, whatever its
	// status says: each reason work_package_not_ready names, in its
	// order, and each element work_package_order warns of.
	NotReady []string
}

WorkPackage is one work-package record as plan reads it.

type WorkPackagePlan added in v1.7.0

type WorkPackagePlan struct {
	// Packages is every work-package record that parses, in the order the
	// records are read.
	Packages []WorkPackage
	// Satisfied is, per requirement ID, the specification's elements that
	// satisfy it, in document order.
	Satisfied map[string][]string
	// Needs is, per element, the other elements it names, without the
	// links that say what it meets.
	Needs map[string][]string
	// Holders is, per requirement ID, the packages not withdrawn that hold
	// it.
	Holders map[string][]string
}

WorkPackagePlan is what specarch plan reads of the work packages beside a specification (ADR-245, ADR-246): every work-package record, what keeps each from starting as the validator judges it, and the links of the reference graph the order rule reads.

func PlanWorkPackages added in v1.7.0

func PlanWorkPackages(s *spec.Spec) *WorkPackagePlan

PlanWorkPackages reads the work-package records beside a specification as the validator does; nil when the root file is not a specification.

Jump to

Keyboard shortcuts

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