Documentation
¶
Index ¶
- Constants
- Variables
- func IsTruthy(node *YispNode) (bool, error)
- func IsZero(v any) bool
- func JsonPrint(tag string, obj any)
- func RenderCode(file string, line, after, before int, comments []Comment) (string, error)
- func VerifyTypes(node *YispNode, allowUntypedManifest bool) error
- type Attribute
- type Comment
- type Engine
- type Env
- type ErrorTypeEvaluation
- type EvalMode
- type FilePos
- type Kind
- type Lambda
- type Schema
- func (s *Schema) Cast(node *YispNode) (*YispNode, error)
- func (s *Schema) Equals(other *Schema) bool
- func (s *Schema) GetAdditionalProperties() any
- func (s *Schema) GetItems() *Schema
- func (s *Schema) GetPatchMergeKey() string
- func (s *Schema) GetPatchStrategy() string
- func (s *Schema) GetProperties() map[string]*Schema
- func (s *Schema) InterpolateDefaults(node *YispNode) error
- func (s *Schema) ToYispNode() (*YispNode, error)
- func (s *Schema) Validate(node *YispNode) error
- type TypedSymbol
- type YamlDocument
- type YispMap
- type YispNode
- type YispOperator
Constants ¶
View Source
const (
YISP_SPECIAL_MERGE_KEY = "__YISP_MERGE_KEY__"
)
Variables ¶
View Source
var EvaluationError = ErrorTypeEvaluation{Type: "YispErrorEvaluation"}
Functions ¶
func RenderCode ¶
func VerifyTypes ¶ added in v1.3.1
Types ¶
type Attribute ¶
type Engine ¶
type Engine interface {
Run(document io.Reader, env *Env, location string) (*YispNode, error)
Apply(car *YispNode, cdr []*YispNode, env *Env, mode EvalMode) (*YispNode, error)
Eval(node *YispNode, env *Env, mode EvalMode) (*YispNode, error)
Render(node *YispNode) (string, error)
GetOption(key string) (any, bool)
}
type Env ¶
Env represents the execution environment with variable bindings
func (*Env) CreateChild ¶
type ErrorTypeEvaluation ¶
type ErrorTypeEvaluation struct {
Type string
Node *YispNode
Message string
Parent *ErrorTypeEvaluation
}
func NewEvaluationError ¶
func NewEvaluationError(node *YispNode, message string) *ErrorTypeEvaluation
func NewEvaluationErrorWithParent ¶
func NewEvaluationErrorWithParent(node *YispNode, message string, parent error) *ErrorTypeEvaluation
func (*ErrorTypeEvaluation) Error ¶
func (e *ErrorTypeEvaluation) Error() string
func (*ErrorTypeEvaluation) GetRoot ¶
func (e *ErrorTypeEvaluation) GetRoot() *ErrorTypeEvaluation
func (*ErrorTypeEvaluation) String ¶
func (e *ErrorTypeEvaluation) String() string
type Lambda ¶
type Lambda struct {
Arguments []TypedSymbol
Returns *Schema
Body *YispNode
Clojure *Env
}
type Schema ¶
type Schema struct {
ID string `json:"$id,omitempty"`
Ref string `json:"$ref,omitempty"`
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Required []string `json:"required,omitempty"`
Properties map[string]*Schema `json:"properties,omitempty"`
Items *Schema `json:"items,omitempty"`
AdditionalProperties any `json:"additionalProperties,omitempty"`
Arguments []*Schema `json:"arguments,omitempty"`
Returns *Schema `json:"returns,omitempty"`
Description string `json:"description,omitempty"`
Default any `json:"default,omitempty"`
OneOf []*Schema `json:"oneOf,omitempty"`
// Numeric constraints
MultipleOf *int `json:"multipleOf,omitempty"`
Minimum *float64 `json:"minimum,omitempty"`
Maximum *float64 `json:"maximum,omitempty"`
ExclusiveMinimum *float64 `json:"exclusiveMinimum,omitempty"`
ExclusiveMaximum *float64 `json:"exclusiveMaximum,omitempty"`
// String constraints
MinLength *int `json:"minLength,omitempty"`
MaxLength *int `json:"maxLength,omitempty"`
PatchStrategy string `json:"patchStrategy,omitempty"`
PatchMergeKey string `json:"patchMergeKey,omitempty"`
K8sPatchStrategy string `json:"x-kubernetes-patch-strategy,omitempty"`
K8sPatchMergeKey string `json:"x-kubernetes-patch-merge-key,omitempty"`
}
func LoadSchemaFromGVK ¶
func LoadSchemaFromID ¶
func LoadSchemaFromURL ¶ added in v1.3.0
func (*Schema) GetAdditionalProperties ¶
func (*Schema) GetPatchMergeKey ¶
func (*Schema) GetPatchStrategy ¶
func (*Schema) GetProperties ¶
func (*Schema) InterpolateDefaults ¶
func (*Schema) ToYispNode ¶
type TypedSymbol ¶
type YamlDocument ¶
type YamlDocument []any
type YispMap ¶
type YispMap = orderedmap.OrderedMap[string, any]
func NewYispMap ¶
func NewYispMap() *YispMap
Click to show internal directories.
Click to hide internal directories.