validation

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 8 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 validation provides CUE-based configuration validation for FTL

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Name        string            `json:"name,omitempty"`
	Version     string            `json:"version,omitempty"`
	Description string            `json:"description,omitempty"`
	Access      string            `json:"access,omitempty"`
	Auth        *AuthConfig       `json:"auth,omitempty"`
	Components  []*Component      `json:"components,omitempty"`
	Variables   map[string]string `json:"variables,omitempty"`
}

Application represents a validated FTL application These are strongly-typed, validated structures derived from CUE

func ExtractApplication

func ExtractApplication(v cue.Value) (*Application, error)

ExtractApplication extracts validated application data from CUE value

type AuthConfig

type AuthConfig struct {
	JWTIssuer   string      `json:"jwt_issuer,omitempty"`
	JWTAudience string      `json:"jwt_audience,omitempty"`
	JWTJwksURI  string      `json:"jwt_jwks_uri,omitempty"`
	Policy      string      `json:"policy,omitempty"`
	PolicyData  interface{} `json:"policy_data,omitempty"` // Can be string or map
}

AuthConfig represents authentication configuration

type BuildConfig

type BuildConfig struct {
	Command string   `json:"command"`
	Workdir string   `json:"workdir,omitempty"`
	Watch   []string `json:"watch,omitempty"`
}

BuildConfig represents build configuration

type Component

type Component struct {
	ID        string            `json:"id"`
	Source    ComponentSource   `json:"-"` // Exclude from automatic JSON marshaling
	Build     *BuildConfig      `json:"build,omitempty"`
	Variables map[string]string `json:"variables,omitempty"`
}

Component represents a validated component

func (Component) MarshalJSON

func (c Component) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for Component to handle the Source interface

type ComponentSource

type ComponentSource interface {
	// contains filtered or unexported methods
}

ComponentSource is either local or registry

type LocalSource

type LocalSource struct {
	Path string `json:"path"`
}

LocalSource represents a local component source

type RegistrySource

type RegistrySource struct {
	Registry string `json:"registry"`
	Package  string `json:"package"`
	Version  string `json:"version"`
}

RegistrySource represents a registry component source

type Validator

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

Validator provides CUE-based validation for FTL configurations

func New

func New() *Validator

New creates a new validator instance

func (*Validator) ValidateCUE

func (v *Validator) ValidateCUE(data []byte) (cue.Value, error)

ValidateCUE validates CUE configuration against FTL schema

func (*Validator) ValidateJSON

func (v *Validator) ValidateJSON(data []byte) (cue.Value, error)

ValidateJSON validates JSON configuration against FTL schema

func (*Validator) ValidateYAML

func (v *Validator) ValidateYAML(data []byte) (cue.Value, error)

ValidateYAML validates YAML configuration against FTL schema

Jump to

Keyboard shortcuts

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