schema

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package schema defines the immutable, versioned representation of a resolved Ridu configuration.

Resolved schemas contain declarative metadata only. They never contain executable access rules, secrets, or database connections.

Index

Constants

View Source
const CurrentAdminPluginAPIVersion uint32 = 1

CurrentAdminPluginAPIVersion is the static backend/admin pairing contract understood by this manifest version.

View Source
const CurrentPluginAPIVersion uint32 = 1

CurrentPluginAPIVersion is the compiled backend plugin contract represented by this manifest version.

View Source
const EmbeddedTreeVersion uint32 = 1

EmbeddedTreeVersion is the declarative embedded-value metadata contract.

Variables

This section is empty.

Functions

func BindBlockReferences added in v0.2.0

func BindBlockReferences(snapshot *Snapshot) error

BindBlockReferences validates the registry and attaches lazy placement views. It does not evaluate access, defaults, hooks or other executable behavior.

func IsSupportedEndpointMethod

func IsSupportedEndpointMethod(method string) bool

IsSupportedEndpointMethod reports whether method is part of the custom endpoint contract. Config resolution stores supported methods in uppercase.

func IsValidAdminPluginAsset

func IsValidAdminPluginAsset(value string) bool

IsValidAdminPluginAsset reports whether value is a safe package-relative side-effect import generated into the static admin entry.

func IsValidAdminPluginExport

func IsValidAdminPluginExport(value string) bool

IsValidAdminPluginExport reports whether value can be used as a named JavaScript import without computed or executable syntax.

func IsValidAdminPluginPackage

func IsValidAdminPluginPackage(value string) bool

IsValidAdminPluginPackage reports whether value is a static JavaScript package specifier rather than a relative path or generated-code fragment.

func IsValidAdminPluginRoute

func IsValidAdminPluginRoute(value string) bool

IsValidAdminPluginRoute reports whether a relative plugin route cannot shadow framework-owned login or collection routes.

func IsValidBlockTypeName added in v0.2.0

func IsValidBlockTypeName(value string) bool

IsValidBlockTypeName reports whether a generated block name is portable to Go and TypeScript.

func IsValidCollectionSlug

func IsValidCollectionSlug(value string) bool

IsValidCollectionSlug reports whether a collection slug has the canonical lowercase kebab-case form.

func IsValidEndpointPath

func IsValidEndpointPath(path string) bool

IsValidEndpointPath reports whether path is a deterministic custom endpoint pattern. Paths begin with / and may use complete named segments such as :id. Query strings, fragments, traversal, empty segments, and partial parameters are rejected.

func IsValidFieldName

func IsValidFieldName(value string) bool

IsValidFieldName reports whether a field name is safe as an unquoted generated property and query path segment.

func IsValidGoPackage

func IsValidGoPackage(value string) bool

IsValidGoPackage reports whether value is a portable Go import path.

func IsValidLocaleCode

func IsValidLocaleCode(value string) bool

IsValidLocaleCode reports whether a locale code is safe in URLs, generated contracts, and deterministic PostgreSQL identifiers. Request control tokens are reserved and cannot be configured as locales.

func IsValidPluginKey

func IsValidPluginKey(value string) bool

IsValidPluginKey reports whether a plugin key has the canonical kebab-case form.

func IsValidSemanticVersion

func IsValidSemanticVersion(value string) bool

IsValidSemanticVersion reports whether value is a complete semantic version.

func IsValidSemanticVersionRange

func IsValidSemanticVersionRange(minimum, maximumExclusive string) bool

IsValidSemanticVersionRange reports whether minimum and the optional exclusive maximum form a non-empty semantic-version interval.

func IsValidStableID

func IsValidStableID(value string) bool

IsValidStableID reports whether a stable ID has the canonical kebab-case form.

func SemanticVersionInRange

func SemanticVersionInRange(version, minimum, maximumExclusive string) bool

SemanticVersionInRange reports whether version is inside a validated inclusive-minimum, exclusive-maximum interval.

func ValidateEmbeddedMetadata added in v0.2.0

func ValidateEmbeddedMetadata(snapshot Snapshot) error

ValidateEmbeddedMetadata validates descriptor structure before consumers can interpret it. Finite schema depth also rejects recursive/cyclic schema graphs.

func ValidateEmbeddedTrees added in v0.2.0

func ValidateEmbeddedTrees(trees []EmbeddedTree, path string) error

ValidateEmbeddedTrees checks the bounded descriptor language. Roots must be disjoint so the same structural node cannot be consumed by two descriptors.

func ValidateFieldEditor added in v0.2.0

func ValidateFieldEditor(kind FieldType, editor *FieldEditor) error

ValidateFieldEditor validates presentation metadata independently of frontend code.

func ValidateFieldEditors added in v0.2.0

func ValidateFieldEditors(snapshot Snapshot) error

ValidateFieldEditors checks local editor declarations before generation or runtime use.

Types

type AdminLanguage

type AdminLanguage struct {
	Code              string            `json:"code"`
	Label             string            `json:"label"`
	LabelTranslations map[string]string `json:"labelTranslations,omitempty"`
	RTL               bool              `json:"rtl,omitempty"`
}

AdminLanguage is one statically bundled interface language.

type AdminLocalizationSettings

type AdminLocalizationSettings struct {
	Languages       []AdminLanguage `json:"languages"`
	DefaultLanguage string          `json:"defaultLanguage"`
	TimeZones       []AdminTimeZone `json:"timeZones,omitempty"`
	DefaultTimeZone string          `json:"defaultTimeZone,omitempty"`
}

AdminLocalizationSettings configures translated interface presentation. It remains independent from content LocalizationSettings.

type AdminSettings

type AdminSettings struct {
	// UserCollectionID is the durable identity of the selected auth collection.
	UserCollectionID StableID `json:"userCollectionId"`
	// UserCollectionSlug is the API-facing slug of the selected auth collection.
	UserCollectionSlug CollectionSlug `json:"userCollectionSlug"`
}

AdminSettings identifies the auth collection trusted by the admin UI.

type AdminTimeZone

type AdminTimeZone struct {
	ID                string            `json:"id"`
	Label             string            `json:"label"`
	LabelTranslations map[string]string `json:"labelTranslations,omitempty"`
}

AdminTimeZone is one IANA timezone offered to editors.

type Application

type Application struct {
	// Name is the resolved author-facing application name.
	Name string `json:"name"`
	// NameTranslations overrides Name for configured admin interface languages.
	NameTranslations map[string]string `json:"nameTranslations,omitempty"`
	// AllowIDOnCreate permits callers to supply a validated canonical string ID
	// on ordinary creates. Migration imports preserve source IDs independently.
	AllowIDOnCreate bool `json:"allowIDOnCreate,omitempty"`
	// Admin contains admin authentication policy when auth is enabled.
	Admin *AdminSettings `json:"admin,omitempty"`
	// AdminLocalization is the deterministic interface language and timezone
	// contract. Catalog text is supplied by the statically built admin.
	AdminLocalization *AdminLocalizationSettings `json:"adminLocalization,omitempty"`
	// Localization is the deterministic content-locale contract, when enabled.
	Localization *LocalizationSettings `json:"localization,omitempty"`
	// Endpoints lists application-level custom endpoint metadata. Executable
	// handlers remain in Go runtime configuration.
	Endpoints []Endpoint `json:"endpoints,omitempty"`
}

Application contains framework-level application metadata.

type ArrayRowLabels

type ArrayRowLabels struct {
	Singular             string            `json:"singular"`
	SingularTranslations map[string]string `json:"singularTranslations,omitempty"`
	Plural               string            `json:"plural"`
	PluralTranslations   map[string]string `json:"pluralTranslations,omitempty"`
}

ArrayRowLabels contains singular and plural author-facing array item names.

type AuthSettings

type AuthSettings struct {
	IdentityField                     string `json:"identityField"`
	SessionDurationSeconds            int64  `json:"sessionDurationSeconds"`
	PasswordMinLength                 int    `json:"passwordMinLength"`
	PasswordMaxBytes                  int    `json:"passwordMaxBytes"`
	PasswordBcryptCost                int    `json:"passwordBcryptCost"`
	MaxLoginAttempts                  int    `json:"maxLoginAttempts"`
	LockDurationSeconds               int64  `json:"lockDurationSeconds"`
	PasswordReset                     bool   `json:"passwordReset"`
	PasswordResetTokenDurationSeconds int64  `json:"passwordResetTokenDurationSeconds"`
	VerifyEmail                       bool   `json:"verifyEmail"`
	VerificationTokenDurationSeconds  int64  `json:"verificationTokenDurationSeconds"`
	APIKeys                           bool   `json:"apiKeys"`
}

type BlockAdmin added in v0.2.0

type BlockAdmin struct {
	NameField string `json:"nameField,omitempty"`
	RowLabel  string `json:"rowLabel,omitempty"`
}

BlockAdmin contains presentation metadata derived from direct block children.

type BlockLabels added in v0.2.0

type BlockLabels struct {
	Singular             string            `json:"singular"`
	Plural               string            `json:"plural"`
	SingularTranslations map[string]string `json:"singularTranslations,omitempty"`
	PluralTranslations   map[string]string `json:"pluralTranslations,omitempty"`
}

BlockLabels contains resolved author-facing names and admin language overrides.

type BlockType

type BlockType struct {
	TypeName string      `json:"typeName,omitempty"`
	Admin    *BlockAdmin `json:"admin,omitempty"`
	Slug     string      `json:"slug"`
	Labels   BlockLabels `json:"labels"`
	Fields   []Field     `json:"fields"`
	// contains filtered or unexported fields
}

func BlockTemplate added in v0.2.0

func BlockTemplate(block BlockType, resource StableID, prefix []string) BlockType

BlockTemplate detaches one resolved definition and makes field paths relative to its root. Only inline structure is copied; nested references stay compact.

func (BlockType) ResolvedFields added in v0.2.0

func (b BlockType) ResolvedFields() []Field

ResolvedFields exposes placement-aware children. Registered metadata is shared; child placement views are materialized only when traversed. As with other snapshot fields, callers must not mutate a view concurrently with traversal.

type BlocksField

type BlocksField struct {
	BlockReferences []string `json:"blockReferences,omitempty"`

	MinRows int         `json:"minRows,omitempty"`
	MaxRows int         `json:"maxRows,omitempty"`
	Types   []BlockType `json:"types,omitempty"`
	// contains filtered or unexported fields
}

func ReferenceTypes added in v0.2.0

func ReferenceTypes(slugs []string, definitions map[string]BlockType, resource StableID, path []string) *BlocksField

ReferenceTypes binds a registry field during config resolution. The definitions map is builder-owned until the final immutable manifest is installed.

func (BlocksField) ResolvedTypes added in v0.2.0

func (b BlocksField) ResolvedTypes() []BlockType

type Capabilities

type Capabilities struct {
	Auth     bool `json:"auth"`
	Upload   bool `json:"upload"`
	Versions bool `json:"versions"`
	Trash    bool `json:"trash"`
	Locking  bool `json:"locking,omitempty"`
	Global   bool `json:"global,omitempty"`
}

Capabilities reserves explicit, typed manifest positions for collection behaviors that arrive in later vertical slices.

type CodeField

type CodeField struct {
	Language  string `json:"language,omitempty"`
	MinLength *int   `json:"minLength,omitempty"`
	MaxLength *int   `json:"maxLength,omitempty"`
}

CodeField contains editor metadata for a stored source string.

type Collection

type Collection struct {
	ID           StableID              `json:"id"`
	Slug         CollectionSlug        `json:"slug"`
	Labels       CollectionLabels      `json:"labels"`
	Admin        CollectionAdmin       `json:"admin"`
	Capabilities Capabilities          `json:"capabilities"`
	Auth         *AuthSettings         `json:"authSettings,omitempty"`
	Upload       *UploadSettings       `json:"uploadSettings,omitempty"`
	Versions     *VersionSettings      `json:"versionSettings,omitempty"`
	DocumentLock *DocumentLockSettings `json:"documentLockSettings,omitempty"`
	Fields       []Field               `json:"fields"`
	Indexes      []CollectionIndex     `json:"indexes,omitempty"`
	Endpoints    []Endpoint            `json:"endpoints,omitempty"`
}

Collection is one resolved collection schema.

type CollectionAdmin

type CollectionAdmin struct {
	UseAsTitle              string            `json:"useAsTitle,omitempty"`
	DefaultColumns          []string          `json:"defaultColumns,omitempty"`
	Group                   string            `json:"group,omitempty"`
	GroupTranslations       map[string]string `json:"groupTranslations,omitempty"`
	Description             string            `json:"description,omitempty"`
	DescriptionTranslations map[string]string `json:"descriptionTranslations,omitempty"`
	FolderField             string            `json:"folderField,omitempty"`
	ParentField             string            `json:"parentField,omitempty"`
	LivePreview             *LivePreview      `json:"livePreview,omitempty"`
}

type CollectionIndex

type CollectionIndex struct {
	Fields []query.Path `json:"fields"`
	Unique bool         `json:"unique,omitempty"`
}

CollectionIndex is one ordered compound index over supported field paths. Unique indexes use NULLS DISTINCT semantics in every official store.

type CollectionLabels

type CollectionLabels struct {
	Singular             string            `json:"singular"`
	SingularTranslations map[string]string `json:"singularTranslations,omitempty"`
	Plural               string            `json:"plural"`
	PluralTranslations   map[string]string `json:"pluralTranslations,omitempty"`
}

CollectionLabels contains normalized author-facing names.

type CollectionSlug

type CollectionSlug string

CollectionSlug is the URL- and API-facing name of a collection.

type DateField

type DateField struct {
	Format DateFormat `json:"format"`
}

DateField describes how a stored date string is authored and presented.

type DateFormat added in v0.2.0

type DateFormat string

DateFormat identifies the accepted date string contract across APIs and admin.

const (
	DateOnly DateFormat = "date"
	DateTime DateFormat = "date-time"
	TimeOnly DateFormat = "time"
)

type DocumentLockSettings

type DocumentLockSettings struct {
	DurationSeconds int64 `json:"durationSeconds"`
}

DocumentLockSettings controls the admin lock lease for one collection.

type EmbeddedTree added in v0.2.0

type EmbeddedTree struct {
	Version  uint32             `json:"version"`
	Key      string             `json:"key"`
	Root     []string           `json:"root"`
	Children string             `json:"children"`
	Tag      string             `json:"tag"`
	Cases    []EmbeddedTreeCase `json:"cases"`
}

EmbeddedTree locates a structural node or node list through literal properties. Only Children is recursively traversed; case payloads use ordinary schemas.

type EmbeddedTreeCase added in v0.2.0

type EmbeddedTreeCase struct {
	BlockReferences []string `json:"blockReferences,omitempty"`

	TagValue      string      `json:"tagValue"`
	Payload       string      `json:"payload"`
	Discriminator string      `json:"discriminator"`
	Identity      string      `json:"identity"`
	Types         []BlockType `json:"types,omitempty"`
	// contains filtered or unexported fields
}

func ReferenceCase added in v0.2.0

func ReferenceCase(c EmbeddedTreeCase, definitions map[string]BlockType, resource StableID, path []string) EmbeddedTreeCase

func (EmbeddedTreeCase) ResolvedTypes added in v0.2.0

func (c EmbeddedTreeCase) ResolvedTypes() []BlockType

type Endpoint

type Endpoint struct {
	Method  string `json:"method"`
	Path    string `json:"path"`
	Summary string `json:"summary,omitempty"`
}

Endpoint is the deterministic public metadata for one application-authored custom endpoint. Handler code and body limits are runtime-only.

type Field

type Field struct {
	ID        StableID      `json:"id"`
	Name      string        `json:"name"`
	Path      query.Path    `json:"path"`
	Type      FieldType     `json:"type"`
	Category  FieldCategory `json:"category"`
	Required  bool          `json:"required"`
	Unique    bool          `json:"unique"`
	Index     bool          `json:"index,omitempty"`
	Localized bool          `json:"localized,omitempty"`
	// QueryRestricted records an attached read policy's static prohibition on
	// caller filtering, sorting and distinct queries. It is not an access verdict.
	QueryRestricted bool    `json:"queryRestricted,omitempty"`
	Default         *string `json:"default,omitempty"`
	// DynamicDefault permits omitted input to reach server initialization. It does
	// not contain executable code or promise that the callback supplies a value.
	DynamicDefault bool `json:"dynamicDefault,omitempty"`
	// LiveValidation enables explicit advisory server feedback without serializing callbacks.
	LiveValidation bool                `json:"liveValidation,omitempty"`
	Admin          FieldAdmin          `json:"admin"`
	Text           *TextField          `json:"text,omitempty"`
	Textarea       *TextField          `json:"textarea,omitempty"`
	Code           *CodeField          `json:"code,omitempty"`
	Number         *NumberField        `json:"number,omitempty"`
	Date           *DateField          `json:"date,omitempty"`
	Select         *SelectField        `json:"select,omitempty"`
	Point          *PointField         `json:"point,omitempty"`
	UI             *UIField            `json:"ui,omitempty"`
	Join           *JoinField          `json:"join,omitempty"`
	Virtual        *VirtualField       `json:"virtual,omitempty"`
	Relationship   *RelationshipField  `json:"relationship,omitempty"`
	List           *PrimitiveListField `json:"list,omitempty"`
	Upload         *UploadField        `json:"upload,omitempty"`
	Nested         *NestedField        `json:"nested,omitempty"`
	Blocks         *BlocksField        `json:"blocks,omitempty"`
	Plugin         *PluginField        `json:"plugin,omitempty"`
}

Field is one resolved field with exactly one matching typed detail contract.

func ChildFields added in v0.2.0

func ChildFields(field Field) []Field

ChildFields enumerates immediate ordinary schema children, including those declared by plugins. It never examines document values or plugin settings.

func EmbeddedBlocks added in v0.2.0

func EmbeddedBlocks(field Field) []Field

EmbeddedBlocks supplies virtual schema-only Blocks containers for each descriptor case. These do not represent stored fields or queryable columns. They allow schema consumers to reuse the ordinary variant catalog.

func EmbeddedTypeFields added in v0.2.0

func EmbeddedTypeFields(field Field, selectors []string) []Field

EmbeddedTypeFields selects schema-only payload containers in generic argument order.

type FieldAdmin

type FieldAdmin struct {
	// Extensions are public finite JSON attachments owned by this field.
	Extensions              map[string]json.RawMessage `json:"extensions,omitempty"`
	Editor                  *FieldEditor               `json:"editor,omitempty"`
	Label                   string                     `json:"label"`
	LabelTranslations       map[string]string          `json:"labelTranslations,omitempty"`
	Description             string                     `json:"description,omitempty"`
	DescriptionTranslations map[string]string          `json:"descriptionTranslations,omitempty"`
	Placeholder             string                     `json:"placeholder,omitempty"`
	PlaceholderTranslations map[string]string          `json:"placeholderTranslations,omitempty"`
	ReadOnly                bool                       `json:"readOnly,omitempty"`
	Hidden                  bool                       `json:"hidden,omitempty"`
	Sidebar                 bool                       `json:"sidebar,omitempty"`
	Columns                 int                        `json:"columns,omitempty"`
	Row                     *FieldRow                  `json:"row,omitempty"`
	Collapsible             *FieldCollapsible          `json:"collapsible,omitempty"`
	Tab                     string                     `json:"tab,omitempty"`
	TabTranslations         map[string]string          `json:"tabTranslations,omitempty"`
	TabGroup                *FieldTabGroup             `json:"tabGroup,omitempty"`
	NamedTab                bool                       `json:"namedTab,omitempty"`
	Condition               *FieldCondition            `json:"condition,omitempty"`
	Component               *FieldAdminComponent       `json:"component,omitempty"`
}

FieldAdmin contains serializable presentation metadata, never authorization.

type FieldAdminComponent

type FieldAdminComponent struct {
	// Reference selects an application-local row label; it is not valid for field renderers.
	Reference string          `json:"reference,omitempty"`
	Plugin    string          `json:"plugin,omitempty"`
	Component string          `json:"component,omitempty"`
	Config    json.RawMessage `json:"config,omitempty"`
}

FieldAdminComponent selects one statically registered plugin renderer for a field without changing its storage, validation, access, or generated type.

type FieldCategory

type FieldCategory string

FieldCategory distinguishes broad field behavior without a stringly typed capability map.

const (
	FieldCategoryScalar       FieldCategory = "scalar"
	FieldCategoryNested       FieldCategory = "nested"
	FieldCategoryPresentation FieldCategory = "presentation"
	FieldCategoryRelationship FieldCategory = "relationship"
	FieldCategoryUpload       FieldCategory = "upload"
	FieldCategoryPlugin       FieldCategory = "plugin"
)

type FieldCollapsible

type FieldCollapsible struct {
	ID                 StableID                   `json:"id"`
	Label              string                     `json:"label"`
	LabelTranslations  map[string]string          `json:"labelTranslations,omitempty"`
	InitiallyCollapsed bool                       `json:"initiallyCollapsed,omitempty"`
	Extensions         map[string]json.RawMessage `json:"extensions,omitempty"`
}

FieldCollapsible identifies flattened fields presented inside one disclosure.

type FieldCondition

type FieldCondition struct {
	Kind       FieldConditionKind       `json:"kind"`
	Conditions []FieldCondition         `json:"conditions,omitempty"`
	Predicate  *FieldConditionPredicate `json:"predicate,omitempty"`
}

FieldCondition is one recursive, presentation-only condition node.

type FieldConditionKind

type FieldConditionKind string

FieldConditionKind identifies one node in a deterministic presentation expression.

const (
	FieldConditionKindAll       FieldConditionKind = "all"
	FieldConditionKindAny       FieldConditionKind = "any"
	FieldConditionKindNot       FieldConditionKind = "not"
	FieldConditionKindPredicate FieldConditionKind = "predicate"
)

type FieldConditionOperator

type FieldConditionOperator string

FieldConditionOperator identifies one scalar condition comparison.

const (
	FieldConditionEquals    FieldConditionOperator = "equals"
	FieldConditionNotEquals FieldConditionOperator = "notEquals"
	FieldConditionOneOf     FieldConditionOperator = "oneOf"
)

type FieldConditionPredicate

type FieldConditionPredicate struct {
	Scope    FieldConditionScope    `json:"scope"`
	Path     query.Path             `json:"path"`
	Operator FieldConditionOperator `json:"operator"`
	Values   []ScalarLiteral        `json:"values"`
}

FieldConditionPredicate compares one scoped document value with typed scalars.

type FieldConditionScope

type FieldConditionScope string

FieldConditionScope selects the value tree used by a condition predicate.

const (
	FieldConditionDocument FieldConditionScope = "document"
	FieldConditionSibling  FieldConditionScope = "sibling"
)

type FieldEditor added in v0.2.0

type FieldEditor struct {
	Reference string          `json:"reference"`
	Config    json.RawMessage `json:"config,omitempty"`
}

FieldEditor selects an application-local value editor. Config is public JSON.

type FieldRow

type FieldRow struct {
	ID         StableID                   `json:"id"`
	Extensions map[string]json.RawMessage `json:"extensions,omitempty"`
}

FieldRow identifies fields authored as one presentation-only layout row. It never contributes a document path or stored value.

type FieldTabGroup

type FieldTabGroup struct {
	ID         StableID                   `json:"id"`
	Extensions map[string]json.RawMessage `json:"extensions,omitempty"`
}

FieldTabGroup identifies fields authored by one presentation tabs definition. It preserves local tab-group boundaries without contributing a document path.

type FieldType

type FieldType string

FieldType identifies the concrete manifest contract for a field.

const (
	FieldTypeText         FieldType = "text"
	FieldTypeTextList     FieldType = "text-list"
	FieldTypeNumberList   FieldType = "number-list"
	FieldTypeCode         FieldType = "code"
	FieldTypeSelect       FieldType = "select"
	FieldTypeRadio        FieldType = "radio"
	FieldTypePoint        FieldType = "point"
	FieldTypeUI           FieldType = "ui"
	FieldTypeJoin         FieldType = "join"
	FieldTypeVirtual      FieldType = "virtual"
	FieldTypeRelationship FieldType = "relationship"
	FieldTypeUpload       FieldType = "upload"
	FieldTypeGroup        FieldType = "group"
	FieldTypeTextarea     FieldType = "textarea"
	FieldTypeEmail        FieldType = "email"
	FieldTypeDate         FieldType = "date"
	FieldTypeNumber       FieldType = "number"
	FieldTypeCheckbox     FieldType = "checkbox"
	FieldTypeJSON         FieldType = "json"
	FieldTypeArray        FieldType = "array"
	FieldTypeBlocks       FieldType = "blocks"
	FieldTypePlugin       FieldType = "plugin"
)

type Global

type Global = Collection

Global is one resolved singleton schema. It deliberately shares the field, version, and presentation contracts used by collections while living in a separate manifest namespace and API route.

type ImageSize

type ImageSize struct {
	Name   string `json:"name"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Fit    string `json:"fit"`
}

type Issue

type Issue struct {
	Code    string `json:"code"`
	Path    string `json:"path"`
	Message string `json:"message"`
	// Target correlates a save issue by portable schema and stable row identity.
	// It is opaque to transports and scoped to the operation's locale/form snapshot.
	Target string `json:"target,omitempty"`
	// FieldID and resource identity describe a resolved application-validator target.
	FieldID      StableID `json:"fieldId,omitempty"`
	CollectionID StableID `json:"collectionId,omitempty"`
	GlobalID     StableID `json:"globalId,omitempty"`
	// Locale is the exact translation addressed by a save issue, without fallback.
	Locale LocaleCode `json:"locale,omitempty"`
}

Issue describes one configuration or document validation failure at a field path.

type JoinField

type JoinField struct {
	CollectionID   StableID       `json:"collectionId"`
	CollectionSlug CollectionSlug `json:"collectionSlug"`
	On             query.Path     `json:"on"`
	Limit          int            `json:"limit"`
	DefaultColumns []string       `json:"defaultColumns,omitempty"`
	DefaultSort    string         `json:"defaultSort,omitempty"`
	AllowCreate    *bool          `json:"allowCreate,omitempty"`
}

JoinField describes a read-only inverse relationship.

type LivePreview

type LivePreview struct {
	URL         string              `json:"url"`
	Breakpoints []PreviewBreakpoint `json:"breakpoints,omitempty"`
}

LivePreview is the serializable document-preview contract consumed by the admin.

type Locale

type Locale struct {
	Code            LocaleCode   `json:"code"`
	Label           string       `json:"label"`
	RTL             bool         `json:"rtl,omitempty"`
	FallbackLocales []LocaleCode `json:"fallbackLocale,omitempty"`
}

Locale is one configured content locale in deterministic authoring order.

type LocaleCode

type LocaleCode string

LocaleCode is the stable request and storage identity of one content locale. It commonly contains a BCP 47 language tag, but may also use an application- owned alphanumeric identifier separated by hyphens or underscores.

type LocalizationSettings

type LocalizationSettings struct {
	Locales       []Locale   `json:"locales"`
	DefaultLocale LocaleCode `json:"defaultLocale"`
	Fallback      bool       `json:"fallback"`
}

LocalizationSettings is the public, serializable content localization contract. Executable locale availability rules remain in Go configuration.

func (LocalizationSettings) LocaleCodes

func (settings LocalizationSettings) LocaleCodes() []LocaleCode

LocaleCodes returns configured locale identities in deterministic authoring order.

type Manifest

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

Manifest owns a deeply copied snapshot. Its state cannot be changed through any public accessor.

func NewManifest

func NewManifest(snapshot Snapshot) Manifest

NewManifest freezes an already validated manifest snapshot.

func Parse

func Parse(encoded []byte) (Manifest, error)

Parse decodes a manifest, rejects unknown properties, and verifies that its format version is supported by this schema package.

func (Manifest) Bytes

func (manifest Manifest) Bytes() ([]byte, error)

Bytes returns the canonical indented manifest encoding with one trailing newline, suitable for generated artifacts and golden fixtures.

func (Manifest) Equal

func (manifest Manifest) Equal(other Manifest) bool

Equal reports whether two manifests have byte-identical canonical encodings.

func (Manifest) MarshalJSON

func (manifest Manifest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler without exposing mutable internals.

func (Manifest) Snapshot

func (manifest Manifest) Snapshot() Snapshot

Snapshot returns a deep copy of the manifest.

func (*Manifest) UnmarshalJSON

func (manifest *Manifest) UnmarshalJSON(encoded []byte) error

UnmarshalJSON replaces a manifest only after Parse validates the complete encoded value.

type NestedField

type NestedField struct {
	Fields            []Field              `json:"fields"`
	MinRows           int                  `json:"minRows,omitempty"`
	MaxRows           int                  `json:"maxRows,omitempty"`
	RowLabel          string               `json:"rowLabel,omitempty"`
	RowLabelComponent *FieldAdminComponent `json:"rowLabelComponent,omitempty"`
	RowLabels         *ArrayRowLabels      `json:"rowLabels,omitempty"`
	// contains filtered or unexported fields
}

NestedField contains recursively resolved child fields.

func (NestedField) ResolvedFields added in v0.2.0

func (n NestedField) ResolvedFields() []Field

type NumberField

type NumberField struct {
	Min  *float64 `json:"min,omitempty"`
	Max  *float64 `json:"max,omitempty"`
	Step *float64 `json:"step,omitempty"`
}

NumberField contains inclusive runtime bounds and the admin input step. Step is presentation metadata and is not a divisibility constraint.

type Plugin

type Plugin struct {
	Key        string               `json:"key"`
	Version    string               `json:"version,omitempty"`
	GoPackage  string               `json:"goPackage,omitempty"`
	APIVersion uint32               `json:"apiVersion,omitempty"`
	Ridu       *PluginCompatibility `json:"ridu,omitempty"`
	Admin      *PluginAdmin         `json:"admin,omitempty"`
	FieldTypes []PluginFieldType    `json:"fieldTypes,omitempty"`
	Endpoints  []PluginEndpoint     `json:"endpoints,omitempty"`
}

Plugin records one compiled plugin that participated in config resolution.

type PluginAdmin

type PluginAdmin struct {
	Package        string   `json:"package"`
	Export         string   `json:"export"`
	APIVersion     uint32   `json:"apiVersion"`
	PairingVersion uint32   `json:"pairingVersion"`
	Routes         []string `json:"routes,omitempty"`
	Assets         []string `json:"assets,omitempty"`
}

PluginAdmin describes one statically imported admin package paired with a compiled backend plugin. It contains only public build metadata, never executable code or secrets.

type PluginCompatibility

type PluginCompatibility struct {
	Minimum          string `json:"minimum"`
	MaximumExclusive string `json:"maximumExclusive,omitempty"`
}

PluginCompatibility is a half-open semantic-version interval.

type PluginEndpoint

type PluginEndpoint struct {
	Method  string `json:"method"`
	Path    string `json:"path"`
	Summary string `json:"summary"`
}

PluginEndpoint is the public manifest contract for one compiled endpoint.

type PluginField

type PluginField struct {
	EmbeddedTrees []EmbeddedTree  `json:"embeddedTrees,omitempty"`
	Key           string          `json:"key"`
	Config        json.RawMessage `json:"config"`
	ReferenceKeys []string        `json:"referenceKeys,omitempty"`
}

type PluginFieldType

type PluginFieldType struct {
	// EmbeddedTypes lists tree.case selectors supplying ordered generic payload type arguments.
	EmbeddedTypes     []string        `json:"embeddedTypes,omitempty"`
	Key               string          `json:"key"`
	TypeScriptPackage string          `json:"typescriptPackage"`
	TypeScriptOutput  string          `json:"typescriptOutput"`
	TypeScriptInput   string          `json:"typescriptInput"`
	TypeScriptWhere   string          `json:"typescriptWhere,omitempty"`
	GoPackage         string          `json:"goPackage,omitempty"`
	GoType            string          `json:"goType,omitempty"`
	JSONSchema        json.RawMessage `json:"jsonSchema,omitempty"`
}

PluginFieldType describes generated language types for one plugin field key.

type PointField

type PointField struct{}

PointField marks a [longitude, latitude] value.

type PreviewBreakpoint

type PreviewBreakpoint struct {
	Name              string            `json:"name"`
	Label             string            `json:"label"`
	LabelTranslations map[string]string `json:"labelTranslations,omitempty"`
	Width             int               `json:"width"`
	Height            int               `json:"height"`
}

PreviewBreakpoint describes one named live-preview viewport.

type PrimitiveListField added in v0.2.0

type PrimitiveListField struct {
	MinRows int `json:"minRows,omitempty"`
	MaxRows int `json:"maxRows,omitempty"`
}

PrimitiveListField constrains the number of values in one ordered text or number list. Items have no stored identity or nested field definitions. TextField and NumberField hold the corresponding per-item constraints.

type ReferenceDeleteAction

type ReferenceDeleteAction string

ReferenceDeleteAction is the resolved current-document policy applied when a relationship or upload target is hard deleted.

const (
	ReferenceDeleteNullify  ReferenceDeleteAction = "nullify"
	ReferenceDeleteRestrict ReferenceDeleteAction = "restrict"
)

type RelationshipField

type RelationshipField struct {
	CollectionID   StableID              `json:"collectionId,omitempty"`
	CollectionSlug CollectionSlug        `json:"collectionSlug,omitempty"`
	Targets        []RelationshipTarget  `json:"targets,omitempty"`
	HasMany        bool                  `json:"hasMany,omitempty"`
	Polymorphic    bool                  `json:"polymorphic,omitempty"`
	OptionFilters  []RelationshipFilter  `json:"optionFilters,omitempty"`
	OnDelete       ReferenceDeleteAction `json:"onDelete"`
}

RelationshipField links to a resolved collection by stable ID and current slug.

type RelationshipFilter

type RelationshipFilter struct {
	CollectionSlug CollectionSlug `json:"collectionSlug,omitempty"`
	TargetPath     query.Path     `json:"targetPath"`
	Operator       string         `json:"operator,omitempty"`
	SourcePath     *query.Path    `json:"sourcePath,omitempty"`
	Value          *ScalarLiteral `json:"value,omitempty"`
}

RelationshipFilter derives an admin option predicate from document data.

type RelationshipTarget

type RelationshipTarget struct {
	CollectionID   StableID       `json:"collectionId"`
	CollectionSlug CollectionSlug `json:"collectionSlug"`
}

type ScalarLiteral added in v0.2.2

type ScalarLiteral struct {
	Type  ValueType `json:"type"`
	Value string    `json:"value"`
}

ScalarLiteral stores a canonical string, finite number, or boolean operand for visibility conditions and relationship filters.

func (ScalarLiteral) Decode added in v0.2.2

func (literal ScalarLiteral) Decode() (query.Value, error)

Decode validates the literal and returns its immutable query value. Numbers retain Go's floating-point parsing rules; booleans must be "true" or "false".

type SelectField

type SelectField struct {
	Options       []SelectOption `json:"options"`
	HasMany       bool           `json:"hasMany,omitempty"`
	DefaultValues []string       `json:"defaultValues,omitempty"`
}

SelectField contains the finite options for a select field.

type SelectOption added in v0.2.0

type SelectOption struct {
	Value             string            `json:"value"`
	Label             string            `json:"label"`
	LabelTranslations map[string]string `json:"labelTranslations,omitempty"`
}

SelectOption is one normalized select value and label.

type SlugField

type SlugField struct {
	SourcePath query.Path `json:"sourcePath"`
}

SlugField derives a normalized URL segment from one non-repeated string field. The operation engine remains authoritative; the admin mirrors this contract.

type Snapshot

type Snapshot struct {
	Version     Version      `json:"version"`
	Application Application  `json:"application"`
	Blocks      []BlockType  `json:"blocks,omitempty"`
	Collections []Collection `json:"collections"`
	Globals     []Global     `json:"globals,omitempty"`
	Plugins     []Plugin     `json:"plugins"`
}

Snapshot is a detached, serializable view of a Manifest.

type StableID

type StableID string

StableID is a deterministic internal schema identity. Migration artifacts record continuity when an authored collection slug or field path changes.

func PlacementFieldID added in v0.2.0

func PlacementFieldID(resource StableID, path []string) StableID

PlacementFieldID keeps inline and referenced field persistence identities equal.

type TextField

type TextField struct {
	MinLength *int       `json:"minLength,omitempty"`
	MaxLength *int       `json:"maxLength,omitempty"`
	Slug      *SlugField `json:"slug,omitempty"`
}

TextField contains inclusive Unicode code-point length constraints and optional first-class slug behavior while retaining ordinary text storage.

type UIField

type UIField struct{}

UIField marks presentation-only content omitted from document values.

type UploadField

type UploadField struct {
	CollectionID   StableID              `json:"collectionId"`
	CollectionSlug CollectionSlug        `json:"collectionSlug"`
	HasMany        bool                  `json:"hasMany,omitempty"`
	OptionFilters  []RelationshipFilter  `json:"optionFilters,omitempty"`
	OnDelete       ReferenceDeleteAction `json:"onDelete"`
}

UploadField references exactly one upload-enabled collection.

type UploadSettings

type UploadSettings struct {
	MaxFileSize int64       `json:"maxFileSize"`
	MimeTypes   []string    `json:"mimeTypes"`
	Private     bool        `json:"private"`
	ImageSizes  []ImageSize `json:"imageSizes,omitempty"`
}

UploadSettings defines collection-owned media validation and delivery.

type ValidationError

type ValidationError struct {
	Issues []Issue `json:"issues"`
}

ValidationError contains every schema issue found during one deterministic validation pass.

func NewValidationError

func NewValidationError(issues []Issue) *ValidationError

NewValidationError copies issues into an inspectable validation error.

func (*ValidationError) Error

func (validationError *ValidationError) Error() string

type ValueType

type ValueType string

ValueType is the finite generated output vocabulary for computed fields.

const (
	ValueTypeString  ValueType = "string"
	ValueTypeNumber  ValueType = "number"
	ValueTypeBoolean ValueType = "boolean"
	ValueTypeJSON    ValueType = "json"
)

type Version

type Version uint32

Version is the schema manifest format version. It changes independently from the Ridu binary version.

const CurrentVersion Version = 1

CurrentVersion is the manifest format produced and accepted by this build.

type VersionSettings

type VersionSettings struct {
	Drafts                  bool  `json:"drafts"`
	MaxPerDocument          int   `json:"maxPerDocument"`
	AutosaveIntervalSeconds int64 `json:"autosaveIntervalSeconds"`
}

VersionSettings defines drafts, snapshot retention, autosave, and optimistic-revision behavior for one collection.

type VirtualField

type VirtualField struct {
	ValueType ValueType `json:"valueType"`
}

VirtualField describes the serialized type of an executable computed value.

Jump to

Keyboard shortcuts

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