model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 5 Imported by: ? 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 model holds the parsed, in-memory representation of a DMN definitions document: the Decision Requirements Graph (DRG), its elements, and the boxed expressions that carry each decision's logic.

The types here are deliberately free of any XML or JSON annotations. The dmn/xml and dmn/vdj packages own the wire formats and project onto these types, so a model loaded from DMN 1.5 XML and one loaded from Verdict Decision JSON are indistinguishable to the evaluator.

Index

Constants

View Source
const (
	TypeAny        = "Any"
	TypeNumber     = "number"
	TypeString     = "string"
	TypeBoolean    = "boolean"
	TypeDate       = "date"
	TypeTime       = "time"
	TypeDateTime   = "date and time"
	TypeDayTimeDur = "days and time duration"
	TypeYearMonth  = "years and months duration"
)

Builtin FEEL type names, as spelled in DMN typeRef attributes. DMN 1.3+ drops the `feel:` prefix but tools still emit it, so the resolver accepts both spellings.

View Source
const ExtensionNamespace = "https://github.com/frankbardon/verdict/schema/1.0"

ExtensionNamespace is the XML namespace Verdict extension elements live under. A standard DMN tool that round-trips a model sees a typed extension element here and either preserves or warns about it.

Variables

This section is empty.

Functions

func AllConformanceLevels

func AllConformanceLevels() []string

AllConformanceLevels returns the canonical spelling of every conformance level a document can declare. LevelUnspecified is excluded: a document that declares nothing omits the field rather than naming a level.

func AllHitPolicyShorthands

func AllHitPolicyShorthands() []string

AllHitPolicyShorthands returns every single-cell hit-policy marker a modeller can write — U, A, P, F, C, C+, C<, C>, C#, R, O.

The list is composed from AllHitPolicies and AllAggregations through Shorthand rather than written out, so it cannot disagree with the formatter it is supposed to describe.

func BuildGraph

func BuildGraph(defs *Definitions) (*Graph, []GraphProblem, error)

BuildGraph indexes a document and computes its topological order. It returns the graph together with any dangling-requirement or duplicate-ID problems; a cycle is returned as an error because no evaluation order exists.

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration renders a duration in the ISO-8601 form DMN policy attributes use. It is the inverse of ParseDuration, so a policy round-trips through either serialisation unchanged.

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses the ISO-8601 duration subset DMN uses for policy attributes: PnDTnHnMnS, optionally negated.

Years and months are rejected. They are legal ISO-8601 and legal FEEL, but a latency or retry budget measured in calendar months has no fixed length and therefore no meaning as a timeout; accepting one would silently pick an arbitrary interpretation.

func ParseHitPolicy

func ParseHitPolicy(s string) (HitPolicy, Aggregation, error)

ParseHitPolicy accepts both the DMN XML spelling ("RULE ORDER") and the shorthand notation used in table headers and documentation ("R", "C+").

func SetExpressionBase

func SetExpressionBase(e Expression, id, typeRef string)

SetExpressionBase writes the shared ID and result type of a boxed expression. The base struct is unexported so that only the DMN readers — which construct expressions from a wire format — can set it; evaluation treats expressions as immutable.

Types

type AgentDecision

type AgentDecision struct {

	// PromptTemplate is a Go text/template rendered against the bound inputs.
	// Template errors are load-time diagnostics, not runtime surprises.
	PromptTemplate string

	Bindings []*AgentInputBinding

	// OutputType declares the shape the response must conform to.
	OutputType TypeSpec

	// Validator is an optional FEEL expression evaluated with the coerced
	// response bound to `value`. A non-true result is a failure.
	Validator string

	Policy AgentPolicy
	// contains filtered or unexported fields
}

AgentDecision delegates evaluation to an agent while keeping the call site typed and traced. It is Verdict's sole non-DMN-native boxed expression and is serialised under ExtensionNamespace.

func (AgentDecision) ExprID

func (b AgentDecision) ExprID() string

func (*AgentDecision) Kind

func (*AgentDecision) Kind() Kind

func (AgentDecision) ResultType

func (b AgentDecision) ResultType() string

type AgentInputBinding

type AgentInputBinding struct {
	Name string
	FEEL string
}

AgentInputBinding binds one prompt/input name to a FEEL expression evaluated against the decision's own context. The agent never sees the raw context — only the values these bindings produce.

type AgentPolicy

type AgentPolicy struct {
	// MaxLatency bounds one invocation including its retries. Zero means the
	// engine default from configuration.
	MaxLatency time.Duration
	// MaxRetries is the number of *additional* attempts after the first.
	MaxRetries int
	// OnFailure selects the recovery behaviour.
	OnFailure FailurePolicy
	// FallbackDecision is the ID or name of a sibling decision evaluated when
	// OnFailure is FailFallback.
	FallbackDecision string
	// SessionHint is passed through to the bridge; a bridge that supports
	// session reuse may key on it.
	SessionHint string
}

AgentPolicy bounds an agent invocation. Latency and retry are enforced by the engine, not by the bridge, so every AgentBridge gets identical guarantees.

type Aggregation

type Aggregation string

Aggregation is the COLLECT aggregator suffix (C+, C<, C>, C#). Empty means a plain COLLECT that returns the unaggregated list.

const (
	AggNone  Aggregation = ""
	AggSum   Aggregation = "SUM"
	AggMin   Aggregation = "MIN"
	AggMax   Aggregation = "MAX"
	AggCount Aggregation = "COUNT"
)

func AllAggregations

func AllAggregations() []Aggregation

AllAggregations returns the COLLECT aggregators. AggNone is excluded: it is the absence of an aggregator, spelled as the empty string, not a member of the set.

type Binding

type Binding struct {
	Parameter *InformationItem
	Value     Expression
}

Binding is one named parameter of an Invocation.

type BusinessKnowledgeModel

type BusinessKnowledgeModel struct {
	ID          string
	Name        string
	Description string
	Variable    *InformationItem

	// Encapsulated is the function definition that carries the BKM's body.
	Encapsulated *FunctionDefinition

	RequiredKnowledge []string
	RequiredInputs    []string
	RequiredDecisions []string
}

BusinessKnowledgeModel is a reusable function in the DRG.

func (*BusinessKnowledgeModel) ElementID

func (b *BusinessKnowledgeModel) ElementID() string

func (*BusinessKnowledgeModel) ElementName

func (b *BusinessKnowledgeModel) ElementName() string

func (*BusinessKnowledgeModel) Requires

func (b *BusinessKnowledgeModel) Requires() []string

type ConformanceLevel

type ConformanceLevel int

ConformanceLevel names the DMN conformance level a model is evaluated at.

const (
	// LevelUnspecified means the loader should fall back to the engine default.
	LevelUnspecified ConformanceLevel = iota
	// Level2 restricts expressions to S-FEEL: decision tables, simple unary
	// tests, arithmetic, comparisons and literals. FEEL-only constructs
	// (for/some/every/if, function definitions, filters) are rejected at parse.
	Level2
	// Level3 admits the full FEEL dialect and the whole boxed-expression family.
	Level3
)

func ParseConformanceLevel

func ParseConformanceLevel(s string) (ConformanceLevel, error)

ParseConformanceLevel maps a configuration string onto a ConformanceLevel.

func (ConformanceLevel) String

func (c ConformanceLevel) String() string

type ContextEntry

type ContextEntry struct {
	Variable *InformationItem
	Value    Expression
}

ContextEntry is one named entry of a ContextExpression.

type ContextExpression

type ContextExpression struct {
	Entries []*ContextEntry
	// contains filtered or unexported fields
}

ContextExpression is a record of named entries. Per DMN, if the final entry has no variable name it is the result of the whole context; otherwise the result is a context value of all entries.

func (ContextExpression) ExprID

func (b ContextExpression) ExprID() string

func (*ContextExpression) Kind

func (*ContextExpression) Kind() Kind

func (ContextExpression) ResultType

func (b ContextExpression) ResultType() string

type DRGElement

type DRGElement interface {
	ElementID() string
	ElementName() string
	// Requires lists the IDs of DRG elements this element depends on.
	Requires() []string
}

DRGElement is any node that can appear in the Decision Requirements Graph.

type Decision

type Decision struct {
	ID          string
	Name        string
	Description string

	// Question and AllowedAnswers are DMN's documentation fields; Verdict
	// surfaces them through `verdict explain`.
	Question       string
	AllowedAnswers string

	// Variable is the output variable this decision binds into the context.
	// Its Name defaults to the decision Name when the document omits it.
	Variable *InformationItem

	// Logic is the boxed expression evaluated to produce the decision's value.
	// Nil means the decision is a documentation-only stub; evaluating it yields
	// null plus a diagnostic.
	Logic Expression

	// RequiredDecisions, RequiredInputs and RequiredKnowledge are the three
	// DMN information/knowledge requirement kinds, stored as element IDs.
	RequiredDecisions []string
	RequiredInputs    []string
	RequiredKnowledge []string

	// AuthorityRequirements point at knowledge sources; non-executable.
	AuthorityRequirements []string
}

Decision is a DRG node that produces a value by evaluating its decision logic.

func (*Decision) ElementID

func (d *Decision) ElementID() string

func (*Decision) ElementName

func (d *Decision) ElementName() string

func (*Decision) OutputName

func (d *Decision) OutputName() string

OutputName is the name this decision binds into the evaluation context.

func (*Decision) Requires

func (d *Decision) Requires() []string

type DecisionService

type DecisionService struct {
	ID          string
	Name        string
	Description string
	Variable    *InformationItem

	// OutputDecisions are the decisions whose values the service returns.
	OutputDecisions []string
	// EncapsulatedDecisions are evaluated as part of the service but not returned.
	EncapsulatedDecisions []string
	// InputDecisions are decisions the caller must supply values for rather than
	// the service evaluating them.
	InputDecisions []string
	// InputData are the input-data elements the service declares.
	InputData []string
}

DecisionService is a named, callable subset of the DRG with declared inputs and outputs.

func (*DecisionService) ElementID

func (s *DecisionService) ElementID() string

func (*DecisionService) ElementName

func (s *DecisionService) ElementName() string

func (*DecisionService) Requires

func (s *DecisionService) Requires() []string

type DecisionTable

type DecisionTable struct {
	HitPolicy   HitPolicy
	Aggregation Aggregation
	Orientation Orientation

	Inputs  []*TableInput
	Outputs []*TableOutput
	Rules   []*TableRule

	// Annotations are the rule-annotation column labels, parallel to
	// TableRule.Annotations.
	Annotations []string
	// contains filtered or unexported fields
}

DecisionTable is DMN's central boxed expression.

func (DecisionTable) ExprID

func (b DecisionTable) ExprID() string

func (*DecisionTable) Kind

func (*DecisionTable) Kind() Kind

func (DecisionTable) ResultType

func (b DecisionTable) ResultType() string

type Definitions

type Definitions struct {
	ID          string
	Name        string
	Namespace   string
	Description string

	// Version is free-form (semver recommended). Empty means unversioned; the
	// registry treats unversioned models as a single mutable slot.
	Version string

	// ExpressionLanguage is the document-level default expression language URI.
	ExpressionLanguage string

	// Level is the conformance level declared by the document, if any.
	Level ConformanceLevel

	Exporter        string
	ExporterVersion string

	ItemDefinitions  []*ItemDefinition
	Decisions        []*Decision
	InputData        []*InputData
	BKMs             []*BusinessKnowledgeModel
	KnowledgeSources []*KnowledgeSource
	DecisionServices []*DecisionService

	// Hash is the content address of the canonical source document. Set by the
	// loader; empty for models built programmatically.
	Hash string
}

Definitions is a whole DMN document: a namespace, a set of DRG elements and the item definitions that type them.

type Expression

type Expression interface {
	// Kind reports the boxed-expression type.
	Kind() Kind
	// ExprID is the DMN element ID, used to anchor diagnostics and trace nodes.
	ExprID() string
	// TypeRef is the declared result type, empty when the model omits it.
	ResultType() string
}

Expression is any boxed expression that can serve as decision logic.

type FailurePolicy

type FailurePolicy string

FailurePolicy names what the engine does when an agentDecision fails to produce a conforming value within its policy budget.

const (
	// FailError propagates the failure and aborts the evaluation. DMN's own
	// error semantics; the Verdict default.
	FailError FailurePolicy = "error"
	// FailNull binds null for the decision and continues.
	FailNull FailurePolicy = "null"
	// FailFallback evaluates FallbackDecision and uses its result.
	FailFallback FailurePolicy = "fallback"
)

func AllFailurePolicies

func AllFailurePolicies() []FailurePolicy

AllFailurePolicies returns what an agentDecision can do when it fails to produce a conforming value within its policy budget.

func ParseFailurePolicy

func ParseFailurePolicy(s string) (FailurePolicy, bool)

ParseFailurePolicy maps the XML attribute value onto a FailurePolicy.

type FunctionDefinition

type FunctionDefinition struct {
	Parameters []*InformationItem
	Body       Expression
	FnKind     FunctionKind
	// contains filtered or unexported fields
}

FunctionDefinition is a callable body with formal parameters.

func (FunctionDefinition) ExprID

func (b FunctionDefinition) ExprID() string

func (*FunctionDefinition) Kind

func (*FunctionDefinition) Kind() Kind

func (FunctionDefinition) ResultType

func (b FunctionDefinition) ResultType() string

type FunctionItem

type FunctionItem struct {
	Parameters []*InformationItem
	OutputType string
}

FunctionItem types a function-valued item definition.

type FunctionKind

type FunctionKind string

FunctionKind distinguishes the three DMN function definition bodies.

const (
	FunctionFEEL FunctionKind = "FEEL"
	FunctionJava FunctionKind = "Java"
	FunctionPMML FunctionKind = "PMML"
)

func AllFunctionKinds

func AllFunctionKinds() []FunctionKind

AllFunctionKinds returns the three DMN function-definition bodies. Java and PMML are parsed and preserved but not executed.

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph is an index over a Definitions document: every DRG element by ID and by name, plus the dependency edges between them. Building a Graph is the point at which dangling requirements and cycles are detected.

func (*Graph) BKM

func (g *Graph) BKM(ref string) (*BusinessKnowledgeModel, bool)

BKM resolves a business knowledge model by ID or name.

func (*Graph) Decision

func (g *Graph) Decision(ref string) (*Decision, bool)

Decision resolves a decision by ID or name.

func (*Graph) Definitions

func (g *Graph) Definitions() *Definitions

Definitions returns the indexed document.

func (*Graph) Element

func (g *Graph) Element(id string) (DRGElement, bool)

Element returns the element with the given ID.

func (*Graph) Layers

func (g *Graph) Layers(ids []string) [][]string

Layers groups the topological order into levels where every element in a level depends only on earlier levels. Independent siblings share a level, so the evaluator can run a whole level concurrently.

func (*Graph) Order

func (g *Graph) Order() []string

Order returns a deterministic topological order of every element ID: dependencies always precede their dependents.

func (*Graph) RequiredBy

func (g *Graph) RequiredBy(id string) []string

RequiredBy lists the IDs of elements that depend on id.

func (*Graph) Requires

func (g *Graph) Requires(id string) []string

Requires lists the IDs id depends on.

func (*Graph) Resolve

func (g *Graph) Resolve(ref string) (DRGElement, bool)

Resolve looks an element up by ID, href or name.

func (*Graph) Service

func (g *Graph) Service(ref string) (*DecisionService, bool)

Service resolves a decision service by ID or name.

func (*Graph) Slice

func (g *Graph) Slice(roots ...string) ([]string, error)

Slice returns the transitive dependency closure of the given element IDs, in topological order and including the roots themselves. This is the evaluation plan for a decision or a decision service.

func (*Graph) Types

func (g *Graph) Types() *TypeRegistry

Types returns the document's type registry.

type GraphProblem

type GraphProblem struct {
	Kind        ProblemKind
	ElementID   string
	ElementName string
	Ref         string
}

GraphProblem is a non-fatal structural problem found while indexing.

type HitPolicy

type HitPolicy string

HitPolicy is a DMN decision-table hit policy. The zero value is Unique, matching the DMN default for an omitted hitPolicy attribute.

const (
	HitUnique      HitPolicy = "UNIQUE"
	HitAny         HitPolicy = "ANY"
	HitPriority    HitPolicy = "PRIORITY"
	HitFirst       HitPolicy = "FIRST"
	HitCollect     HitPolicy = "COLLECT"
	HitRuleOrder   HitPolicy = "RULE ORDER"
	HitOutputOrder HitPolicy = "OUTPUT ORDER"
)

func AllHitPolicies

func AllHitPolicies() []HitPolicy

AllHitPolicies returns every DMN hit policy in its long spelling.

func (HitPolicy) Shorthand

func (h HitPolicy) Shorthand(agg Aggregation) string

Shorthand renders the policy in the compact notation DMN table headers use.

func (HitPolicy) SingleHit

func (h HitPolicy) SingleHit() bool

SingleHit reports whether the policy yields a single value rather than a list.

type InformationItem

type InformationItem struct {
	ID       string
	Name     string
	TypeRef  string
	Optional bool
}

InformationItem is a typed name: a decision's output variable, a BKM parameter, or a context entry's binding.

type InputData

type InputData struct {
	ID          string
	Name        string
	Description string
	Variable    *InformationItem
}

InputData is a named external input supplied by the caller.

func (*InputData) ElementID

func (i *InputData) ElementID() string

func (*InputData) ElementName

func (i *InputData) ElementName() string

func (*InputData) InputName

func (i *InputData) InputName() string

InputName is the key the caller supplies this input under.

func (*InputData) Requires

func (i *InputData) Requires() []string

type Invocation

type Invocation struct {

	// Called names the invoked BKM. DMN encodes this as a nested literal
	// expression whose text is the BKM's name.
	Called   string
	Bindings []*Binding
	// contains filtered or unexported fields
}

Invocation calls a BusinessKnowledgeModel with named parameters.

func (Invocation) ExprID

func (b Invocation) ExprID() string

func (*Invocation) Kind

func (*Invocation) Kind() Kind

func (Invocation) ResultType

func (b Invocation) ResultType() string

type ItemDefinition

type ItemDefinition struct {
	ID          string
	Name        string
	Description string

	// TypeRef names the base type for a simple item definition. Empty when
	// Components is non-empty (a structure).
	TypeRef string

	// IsCollection makes the definition a list of its base type or structure.
	IsCollection bool

	// AllowedValues is a FEEL unary-test list constraining the value domain,
	// e.g. `"low","medium","high"` or `[1..10]`.
	AllowedValues string

	// TypeConstraint is DMN 1.4+'s constraint on a collection as a whole,
	// evaluated with the whole list bound to `?`.
	TypeConstraint string

	// Components are the named fields of a structure type.
	Components []*ItemDefinition

	// FunctionItem, when set, types the definition as a function signature.
	FunctionItem *FunctionItem
}

ItemDefinition is a user-defined type: either a constrained simple type, a collection, or a structure of named components.

func (*ItemDefinition) IsStructure

func (i *ItemDefinition) IsStructure() bool

IsStructure reports whether the definition describes a record type.

type Kind

type Kind string

Kind names a boxed-expression type. Kind strings are stable: they appear in traces, in the node-evaluator registry, and in the VDJ projection.

const (
	KindLiteral       Kind = "literalExpression"
	KindDecisionTable Kind = "decisionTable"
	KindInvocation    Kind = "invocation"
	KindContext       Kind = "context"
	KindList          Kind = "list"
	KindRelation      Kind = "relation"
	KindFunction      Kind = "functionDefinition"
	// KindAgent is the Verdict extension: a decision delegated to an agent.
	KindAgent Kind = "agentDecision"
	// KindUnknown is the placeholder kind carried by an UnknownExpression: logic
	// Verdict preserved but could not interpret.
	KindUnknown Kind = "unknown"
)

func AllKinds

func AllKinds() []Kind

AllKinds returns every boxed-expression kind a VDJ or DMN document can carry, including KindUnknown, which stands in for content Verdict preserved but could not interpret.

type KnowledgeSource

type KnowledgeSource struct {
	ID          string
	Name        string
	Description string
	Type        string
	LocationURI string
	Owner       string
}

KnowledgeSource is a documentation pointer to an external authority. It is never executed; Verdict preserves it for round-tripping and `explain`.

func (*KnowledgeSource) ElementID

func (k *KnowledgeSource) ElementID() string

func (*KnowledgeSource) ElementName

func (k *KnowledgeSource) ElementName() string

func (*KnowledgeSource) Requires

func (k *KnowledgeSource) Requires() []string

type ListExpression

type ListExpression struct {
	Elements []Expression
	// contains filtered or unexported fields
}

ListExpression is an ordered list of boxed expressions.

func (ListExpression) ExprID

func (b ListExpression) ExprID() string

func (*ListExpression) Kind

func (*ListExpression) Kind() Kind

func (ListExpression) ResultType

func (b ListExpression) ResultType() string

type LiteralExpression

type LiteralExpression struct {
	Text string
	// ExpressionLanguage overrides the document default; a non-FEEL language is
	// reported as a diagnostic and evaluates to null.
	ExpressionLanguage string
	// contains filtered or unexported fields
}

LiteralExpression evaluates a single FEEL expression.

func NewLiteral

func NewLiteral(id, typeRef, text string) *LiteralExpression

func (LiteralExpression) ExprID

func (b LiteralExpression) ExprID() string

func (*LiteralExpression) Kind

func (*LiteralExpression) Kind() Kind

func (LiteralExpression) ResultType

func (b LiteralExpression) ResultType() string

type Orientation

type Orientation string

Orientation is a presentation property preserved through round-trips. The engine evaluates both orientations identically.

const (
	RulesAsRows    Orientation = "Rule-as-Row"
	RulesAsColumns Orientation = "Rule-as-Column"
	CrossTable     Orientation = "CrossTable"
)

func AllOrientations

func AllOrientations() []Orientation

AllOrientations returns the decision-table presentation orientations.

type ProblemKind

type ProblemKind string

ProblemKind classifies a graph construction problem.

const (
	ProblemDangling    ProblemKind = "dangling"
	ProblemDuplicateID ProblemKind = "duplicate_id"
	ProblemMissingID   ProblemKind = "missing_id"
)

type Relation

type Relation struct {
	Columns []*InformationItem
	// Rows are parallel to Columns; a row with fewer cells than columns binds
	// the missing entries to null.
	Rows [][]Expression
	// contains filtered or unexported fields
}

Relation is DMN's row-oriented data literal: a table of contexts sharing one column vocabulary.

func (Relation) ExprID

func (b Relation) ExprID() string

func (*Relation) Kind

func (*Relation) Kind() Kind

func (Relation) ResultType

func (b Relation) ResultType() string

type TableInput

type TableInput struct {
	ID    string
	Label string
	// Expression is the FEEL text evaluated once per table evaluation; its value
	// is bound to `?` while the rule's unary tests run.
	Expression string
	TypeRef    string
	// Values is the optional allowed-value list (`inputValues`), used by
	// completeness analysis to enumerate the input domain.
	Values string
}

TableInput is one input clause: the expression whose value each rule's corresponding input entry is tested against.

type TableOutput

type TableOutput struct {
	ID      string
	Label   string
	Name    string
	TypeRef string
	// Values is the `outputValues` list. For PRIORITY and OUTPUT ORDER it is
	// required: it defines the precedence order of output values.
	Values string
	// DefaultValue is the FEEL expression used when no rule matches.
	DefaultValue string
}

TableOutput is one output clause.

type TableRule

type TableRule struct {
	ID          string
	Description string
	// Index is the rule's zero-based position in rule order.
	Index int
	// InputEntries are FEEL unary tests; "-" (or empty) means "any".
	InputEntries []string
	// OutputEntries are FEEL expressions producing this rule's output values.
	OutputEntries []string
	Annotations   []string
}

TableRule is one rule: a list of unary tests parallel to the table's inputs and a list of result expressions parallel to its outputs.

type TypeRegistry

type TypeRegistry struct {
	// contains filtered or unexported fields
}

TypeRegistry resolves typeRef strings against a document's item definitions.

func NewTypeRegistry

func NewTypeRegistry(defs []*ItemDefinition) *TypeRegistry

NewTypeRegistry indexes a document's item definitions by name. Nested component definitions are indexed under `Parent.Child` as well as their own bare name when unambiguous, matching how DMN tools reference them.

func (*TypeRegistry) BaseType

func (r *TypeRegistry) BaseType(typeRef string) string

BaseType strips any namespace prefix and reports the builtin type name a typeRef ultimately resolves to, following item-definition chains.

func (*TypeRegistry) Lookup

func (r *TypeRegistry) Lookup(typeRef string) *ItemDefinition

Lookup resolves a typeRef, tolerating a namespace prefix such as `feel:` or `tns:`. It returns nil for builtin types and for unknown names.

func (*TypeRegistry) Names

func (r *TypeRegistry) Names() []string

Names lists every indexed qualified type name.

type TypeSpec

type TypeSpec struct {
	// TypeRef names a builtin FEEL type or an item definition. Empty means Any.
	TypeRef string
	// Enumeration, when non-empty, restricts the value to this set of strings.
	Enumeration []string
	// Collection marks the value as a list of TypeRef.
	Collection bool
	// Components type a structured response, keyed by field name.
	Components map[string]TypeSpec
}

TypeSpec describes the expected return shape of an agent decision. It is a deliberately small subset of DMN's type system: enough to coerce and validate a model response without asking bridge authors to understand item definitions.

func (TypeSpec) IsAny

func (t TypeSpec) IsAny() bool

IsAny reports whether the spec imposes no constraint at all.

type UnknownExpression

type UnknownExpression struct {
	Detail string
	// contains filtered or unexported fields
}

UnknownExpression stands in for boxed-expression content Verdict could not interpret. It evaluates to null and carries a load-time diagnostic, so a partially understood model still loads and every other decision still runs.

func (UnknownExpression) ExprID

func (b UnknownExpression) ExprID() string

func (*UnknownExpression) Kind

func (*UnknownExpression) Kind() Kind

func (UnknownExpression) ResultType

func (b UnknownExpression) ResultType() string

Jump to

Keyboard shortcuts

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