Documentation
¶
Index ¶
- type Condition
- type Criterion
- type CriterionExpressionType
- type CriterionType
- type CriterionTypeUnion
- func (c *CriterionTypeUnion) GetCore() *core.CriterionTypeUnion
- func (c CriterionTypeUnion) GetType() CriterionType
- func (c CriterionTypeUnion) GetVersion() CriterionTypeVersion
- func (c *CriterionTypeUnion) IsTypeProvided() bool
- func (c *CriterionTypeUnion) Populate(source any) error
- func (c *CriterionTypeUnion) ValidateAsSelectorType(node *yaml.Node, opts ...validation.Option) []error
- type CriterionTypeVersion
- type Operator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct {
// Expression is the expression to the value to be evaluated.
Expression expression.Expression
// Operator is the operator used to compare the value of the condition.
Operator Operator
// Value is the value to compare the value of the condition to.
Value any
// contains filtered or unexported fields
}
Condition represents a condition that will be evaluated for a given criterion.
type Criterion ¶
type Criterion struct {
marshaller.Model[core.Criterion]
// Context is the expression to the value to be evaluated.
Context *expression.Expression
// Condition is the condition to be evaluated.
Condition string
// Type is the type of criterion. Defaults to CriterionTypeSimple.
Type CriterionTypeUnion
// Extensions provides a list of extensions to the Criterion object.
Extensions *extensions.Extensions
}
Criterion represents a criterion that will be evaluated for a given step.
func (*Criterion) GetCondition ¶ added in v0.1.0
GetCondition will return the condition as a parsed condition object
type CriterionExpressionType ¶
type CriterionExpressionType struct {
marshaller.Model[core.CriterionExpressionType]
// Type is the type of criterion.
Type CriterionType
// Version is the version of the criterion type.
Version CriterionTypeVersion
}
CriterionExpressionType represents the type of expression used to evaluate the criterion. In Arazzo 1.1 this is the Expression Type Object, which is also used by Selector Objects and Payload Replacement Objects to describe the selector type and version.
func (*CriterionExpressionType) IsTypeProvided ¶
func (c *CriterionExpressionType) IsTypeProvided() bool
IsTypeProvided will return true if the criterion expression type has a type set.
func (*CriterionExpressionType) Validate ¶
func (c *CriterionExpressionType) Validate(opts ...validation.Option) []error
Validate will validate the criterion expression type object against the Arazzo specification in the context of a Criterion Object (types `jsonpath` and `xpath`).
func (*CriterionExpressionType) ValidateAsSelectorType ¶ added in v1.27.0
func (c *CriterionExpressionType) ValidateAsSelectorType(opts ...validation.Option) []error
ValidateAsSelectorType will validate the expression type object in the context of a Selector Object or Payload Replacement target selector type (types `jsonpath`, `xpath` and `jsonpointer`). Arazzo 1.1+ only.
type CriterionType ¶
type CriterionType string
CriterionType represents the type of criterion.
const ( // CriterionTypeSimple indicates that the criterion represents a simple condition to be evaluated. CriterionTypeSimple CriterionType = "simple" // CriterionTypeRegex indicates that the criterion represents a regular expression to be evaluated. CriterionTypeRegex CriterionType = "regex" // CriterionTypeJsonPath indicates that the criterion represents a JSONPath expression to be evaluated. CriterionTypeJsonPath CriterionType = "jsonpath" // CriterionTypeXPath indicates that the criterion represents an XPath expression to be evaluated. CriterionTypeXPath CriterionType = "xpath" // CriterionTypeJsonPointer indicates a JSON Pointer (RFC 6901) selector. Only valid for Selector Objects // and Payload Replacement target selector types, not for criteria. Arazzo 1.1+ only. CriterionTypeJsonPointer CriterionType = "jsonpointer" )
type CriterionTypeUnion ¶
type CriterionTypeUnion struct {
// Type is the type of criterion.
Type *CriterionType
// ExpressionType is the type of the criterion and any version.
ExpressionType *CriterionExpressionType
// contains filtered or unexported fields
}
CriterionTypeUnion represents the union of a criterion type and criterion expression type.
func (*CriterionTypeUnion) GetCore ¶
func (c *CriterionTypeUnion) GetCore() *core.CriterionTypeUnion
GetCore will return the low level representation of the criterion type union object. Useful for accessing line and column numbers for various nodes in the backing yaml/json document.
func (CriterionTypeUnion) GetType ¶
func (c CriterionTypeUnion) GetType() CriterionType
GetType will return the type of the criterion.
func (CriterionTypeUnion) GetVersion ¶
func (c CriterionTypeUnion) GetVersion() CriterionTypeVersion
GetVersion will return the version of the criterion type.
func (*CriterionTypeUnion) IsTypeProvided ¶
func (c *CriterionTypeUnion) IsTypeProvided() bool
IsTypeProvided will return true if the criterion type union has a type set.
func (*CriterionTypeUnion) Populate ¶ added in v0.2.1
func (c *CriterionTypeUnion) Populate(source any) error
func (*CriterionTypeUnion) ValidateAsSelectorType ¶ added in v1.27.0
func (c *CriterionTypeUnion) ValidateAsSelectorType(node *yaml.Node, opts ...validation.Option) []error
ValidateAsSelectorType will validate the type union as a selector type (`jsonpath`, `xpath` or `jsonpointer`, or an Expression Type Object with one of those types), as used by Selector Objects and Payload Replacement Objects in Arazzo 1.1+. The provided node is used for error locations when the type is a plain string.
type CriterionTypeVersion ¶
type CriterionTypeVersion string
CriterionTypeVersion represents the version of the criterion type.
const ( CriterionTypeVersionNone CriterionTypeVersion = "" CriterionTypeVersionDraftGoessnerDispatchJsonPath00 CriterionTypeVersion = "draft-goessner-dispatch-jsonpath-00" // CriterionTypeVersionRFC9535 is the RFC 9535 JSONPath version (the default JSONPath version in Arazzo 1.1+). CriterionTypeVersionRFC9535 CriterionTypeVersion = "rfc9535" // CriterionTypeVersionXPath31 is the XPath 3.1 version (the default XPath version in Arazzo 1.1+). CriterionTypeVersionXPath31 CriterionTypeVersion = "xpath-31" CriterionTypeVersionXPath30 CriterionTypeVersion = "xpath-30" CriterionTypeVersionXPath20 CriterionTypeVersion = "xpath-20" CriterionTypeVersionXPath10 CriterionTypeVersion = "xpath-10" // CriterionTypeVersionRFC6901 is the RFC 6901 JSON Pointer version. Arazzo 1.1+ only. CriterionTypeVersionRFC6901 CriterionTypeVersion = "rfc6901" )
type Operator ¶
type Operator string
Operator represents the operator used to compare the value of a criterion. TODO ignoring the Logical grouping, index & property de-reference operators for now as there is consistency issues with the spec on how/when these are used (they should probably be part of the expression type)
const ( OperatorLT Operator = "<" OperatorLTE Operator = "<=" OperatorGT Operator = ">" OperatorGTE Operator = ">=" OperatorEQ Operator = "==" OperatorNE Operator = "!=" OperatorNot Operator = "!" // TODO not entirely sure how this is supposed to work OperatorAnd Operator = "&&" OperatorOr Operator = "||" )