expression

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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"
)

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 Arazzo specification.

func ExtractExpressions

func ExtractExpressions(expression string) []Expression

ExtractExpressions will extract all the expressions from the provided string.

func (Expression) GetJSONPointer

func (e Expression) GetJSONPointer() jsonpointer.JSONPointer

GetJSONPointer will return the jsonpointer of the expression.

func (Expression) GetParts

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() bool

IsExpression will return true if the expression is a runtime expression or just an identifier/string.

func (Expression) Validate

func (e Expression) Validate(validateAsExpression bool) error

Validate will validate the expression is valid as per the Arazzo specification.

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 document.
	ExpressionTypeComponents ExpressionType = "components"
)

TODO with specific in arazzo doc types we could validate the full expression include names etc match expectations

Jump to

Keyboard shortcuts

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