Documentation
¶
Index ¶
- Constants
- type Expression
- func (e Expression) GetJSONPointer() jsonpointer.JSONPointer
- func (e Expression) GetParts() (ExpressionType, string, []string, jsonpointer.JSONPointer)
- func (e Expression) GetType() ExpressionType
- func (e Expression) IsExpression(opts ...ValidateOption) bool
- func (e Expression) String() string
- func (e Expression) Validate(opts ...ValidateOption) error
- type ExpressionType
- type ValidateOption
- type ValueOrExpression
Constants ¶
const ( // ReferenceTypeHeader indicates that the expression represents a header reference in the request/response. ReferenceTypeHeader = "header" // ReferenceTypeQuery indicates that the expression represents a query reference in the request. ReferenceTypeQuery = "query" // ReferenceTypePath indicates that the expression represents a path reference in the request. ReferenceTypePath = "path" // ReferenceTypeBody indicates that the expression represents a body reference in the request/response. ReferenceTypeBody = "body" // ReferenceTypePayload indicates that the expression represents a payload reference in the request/response/message (Arazzo 1.1+ only). ReferenceTypePayload = "payload" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression string
Expression represents a runtime expression as defined by the OpenAPI & Arazzo specifications.
func ExtractExpressions ¶
func ExtractExpressions(expression string) []Expression
ExtractExpressions will extract all the expressions from the provided string.
func GetValueOrExpressionValue ¶
func GetValueOrExpressionValue(value ValueOrExpression, opts ...ValidateOption) (*yaml.Node, *Expression, error)
GetValueOrExpressionValue will return the value or expression from the provided ValueOrExpression. Pass WithArazzo11Grammar() to also recognize Arazzo 1.1 expressions such as `$message` and `$self`.
func (Expression) GetJSONPointer ¶
func (e Expression) GetJSONPointer() jsonpointer.JSONPointer
GetJSONPointer will return the jsonpointer of the expression.
func (Expression) GetParts ¶
func (e Expression) GetParts() (ExpressionType, string, []string, jsonpointer.JSONPointer)
GetParts will return the type, reference, expression parts and jsonpointer of the expression.
func (Expression) GetType ¶
func (e Expression) GetType() ExpressionType
GetType will return the type of the expression.
func (Expression) IsExpression ¶
func (e Expression) IsExpression(opts ...ValidateOption) bool
IsExpression will return true if the expression is a runtime expression that starts with a valid expression type. Pass WithArazzo11Grammar() to also recognize the Arazzo 1.1 `$message` and `$self` expressions.
func (Expression) String ¶ added in v1.0.0
func (e Expression) String() string
func (Expression) Validate ¶
func (e Expression) Validate(opts ...ValidateOption) error
Validate will validate the expression is valid as per the OpenAPI & Arazzo specifications. Pass WithArazzo11Grammar() to validate against the Arazzo 1.1 runtime expression grammar.
type ExpressionType ¶
type ExpressionType string
ExpressionType represents the type of expression.
const ( // ExpressionTypeURL indicates that the expression represents the request URL. ExpressionTypeURL ExpressionType = "url" // ExpressionTypeMethod indicates that the expression represents the request method. ExpressionTypeMethod ExpressionType = "method" // ExpressionTypeStatusCode indicates that the expression represents the response status code. ExpressionTypeStatusCode ExpressionType = "statusCode" // ExpressionTypeRequest indicates that the expression represents the request itself. ExpressionTypeRequest ExpressionType = "request" // ExpressionTypeResponse indicates that the expression represents the response itself. ExpressionTypeResponse ExpressionType = "response" // ExpressionTypeInputs indicates that the expression represents the inputs of the workflow. ExpressionTypeInputs ExpressionType = "inputs" // ExpressionTypeOutputs indicates that the expression represents the outputs of the step/workflow. ExpressionTypeOutputs ExpressionType = "outputs" // ExpressionTypeSteps indicates that the expression represents the steps of the workflow. ExpressionTypeSteps ExpressionType = "steps" // ExpressionTypeWorkflows indicates that the expression represents the workflows of the Arazzo document. ExpressionTypeWorkflows ExpressionType = "workflows" // ExpressionTypeSourceDescriptions indicates that the expression represents the source descriptions of the Arazzo document. ExpressionTypeSourceDescriptions ExpressionType = "sourceDescriptions" // ExpressionTypeComponents indicates that the expression represents the components of the Arazzo or OpenAPI document. ExpressionTypeComponents ExpressionType = "components" // ExpressionTypeMessage indicates that the expression represents an AsyncAPI message (Arazzo 1.1+ only). ExpressionTypeMessage ExpressionType = "message" // ExpressionTypeSelf indicates that the expression represents the canonical URI of the current Arazzo document as defined by its `$self` field (Arazzo 1.1+ only). ExpressionTypeSelf ExpressionType = "self" )
TODO with specific in arazzo doc types we could validate the full expression include names etc match expectations
type ValidateOption ¶ added in v1.27.0
type ValidateOption func(o *validateOptions)
ValidateOption configures how expressions are recognized and validated.
func WithArazzo11Grammar ¶ added in v1.27.0
func WithArazzo11Grammar() ValidateOption
WithArazzo11Grammar enables the Arazzo 1.1 runtime expression grammar.
This adds the `$message` and `$self` expression roots and the `payload` source, and applies the stricter Arazzo 1.1 rules for `$inputs`, `$outputs`, `$steps`, `$workflows`, `$sourceDescriptions` and `$components` references. Without this option expressions are validated with the original OpenAPI/Arazzo 1.0 rules.
type ValueOrExpression ¶
ValueOrExpression represents a raw value or expression in the Arazzo document.