schema

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompatibilityResult

type CompatibilityResult struct {
	Classification         DeployClassification `json:"classification"`
	Reason                 string               `json:"reason,omitempty"`
	AddedIDs               []string             `json:"addedIds,omitempty"`
	RemovedIDs             []string             `json:"removedIds,omitempty"`
	ChangedFingerprints    []FingerprintChange  `json:"changedFingerprints,omitempty"`
	ChangedKeyFingerprints []SessionKeyChange   `json:"changedKeyFingerprints,omitempty"`
	AddedKeys              []string             `json:"addedKeys,omitempty"`
	RemovedKeys            []string             `json:"removedKeys,omitempty"`
}

CompatibilityResult describes schema compatibility.

func Compare

func Compare(old, new *Schema) *CompatibilityResult

Compare determines compatibility between two schemas.

type DeployClassification

type DeployClassification string

DeployClassification indicates the type of deploy.

const (
	DeployWarm          DeployClassification = "warm_deploy"
	DeployCold          DeployClassification = "cold_deploy"
	DeploySchemaNeutral DeployClassification = "schema_neutral"
)

type FingerprintChange

type FingerprintChange struct {
	StableID       string `json:"stableId"`
	OldFingerprint string `json:"oldFingerprint"`
	NewFingerprint string `json:"newFingerprint"`
}

FingerprintChange describes a codec fingerprint change.

type PersistedPrimitive

type PersistedPrimitive struct {
	StableID         string `json:"stableID"`
	Scope            string `json:"scope"`
	Kind             string `json:"kind"`
	CodecFingerprint string `json:"codecFingerprint"`
}

PersistedPrimitive represents a persisted primitive in the schema.

type Schema

type Schema struct {
	SchemaVersion       string               `json:"schemaVersion"`
	ToolVersion         string               `json:"toolVersion,omitempty"`
	BuildSchema         string               `json:"buildSchema,omitempty"`
	GeneratedAt         string               `json:"generatedAt,omitempty"`
	PersistedPrimitives []PersistedPrimitive `json:"persistedPrimitives"`
	SessionKeys         []SessionKeySchema   `json:"sessionKeys"`
	SchemaHash          string               `json:"schemaHash"`
}

Schema represents the vango_state_schema.json structure.

func Generate

func Generate(m *manifest.Manifest) (*Schema, error)

Generate creates a schema from a manifest.

func Load

func Load(path string) (*Schema, error)

Load reads a schema from disk.

func NormalizeFromManifest

func NormalizeFromManifest(s *Schema, m *manifest.Manifest) *Schema

NormalizeFromManifest fills missing schema fields using manifest metadata.

func (*Schema) MarshalDeterministic

func (s *Schema) MarshalDeterministic() ([]byte, error)

MarshalDeterministic returns stable JSON output.

func (*Schema) Save

func (s *Schema) Save(path string) error

Save writes a schema to a file with deterministic formatting.

type SessionKeyChange

type SessionKeyChange struct {
	Name           string `json:"name"`
	OldStableID    string `json:"oldStableID,omitempty"`
	NewStableID    string `json:"newStableID,omitempty"`
	OldFingerprint string `json:"oldFingerprint"`
	NewFingerprint string `json:"newFingerprint"`
}

SessionKeyChange describes a session key change.

type SessionKeySchema

type SessionKeySchema struct {
	Name             string `json:"name"`
	StableID         string `json:"stableID"`
	CodecFingerprint string `json:"codecFingerprint"`
	HasDefault       bool   `json:"hasDefault"`
}

SessionKeySchema represents a session key in the schema.

func (*SessionKeySchema) UnmarshalJSON

func (s *SessionKeySchema) UnmarshalJSON(data []byte) error

UnmarshalJSON supports legacy "keyName" fields.

Jump to

Keyboard shortcuts

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