blockspec

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package blockspec builds the Ridu configuration of the block-heavy benchmark from the framework-neutral JSON spec written by ../spec.ts. The serving fixture (../ridu) and the migration-planning probe (../planning) share it, so both measure the same schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(spec Spec, plugins []ridu.Plugin) (ridu.Config, error)

Config maps the spec onto Ridu authoring config. Reference specs register every block in ridu.Config.Blocks and select them by slug; inline specs declare one shared field.Block value per slug with an explicit TypeName, the documented way to reuse an inline definition.

Types

type Block

type Block struct {
	Slug   string  `json:"slug"`
	Fields []Field `json:"fields"`
}

Block is one registry block definition.

type Field

type Field struct {
	Type       string   `json:"type"`
	Name       string   `json:"name"`
	Required   bool     `json:"required,omitempty"`
	Options    []string `json:"options,omitempty"`
	RelationTo string   `json:"relationTo,omitempty"`
	Fields     []Field  `json:"fields,omitempty"`
	Blocks     []string `json:"blocks,omitempty"`
}

Field is one field of a block or resource.

type Resource

type Resource struct {
	Slug   string  `json:"slug"`
	Drafts bool    `json:"drafts"`
	Fields []Field `json:"fields"`
}

Resource is a collection or global.

type Spec

type Spec struct {
	Scenario   string `json:"scenario"`
	References bool   `json:"references"`
	// Hooks gives the first text field of every leaf block executable behavior; see hookedField.
	Hooks       bool       `json:"hooks"`
	Blocks      []Block    `json:"blocks"`
	Collections []Resource `json:"collections"`
	Globals     []Resource `json:"globals"`
}

Spec is one scenario and declaration variant.

func Read

func Read(path string) (Spec, error)

Read decodes the spec at path.

Jump to

Keyboard shortcuts

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