Skip to content

feat(spec): configurable name-object field catalog #815

@GarthDB

Description

@GarthDB

Summary

The current spec hardcodes 13 semantic fields + 3 dimension fields on the token name object. Every time a design system needs a new concept category (typography script, component style, scaleIndex), the spec itself must change. The token-spec-gap-analysis identified 6 proposals for new fields — and that's just Spectrum. Other design systems would have entirely different concept categories.

Proposal: Make the name object schema-configurable via a field declaration mechanism, so design systems declare their own concept categories, vocabulary, and validation rules.

Motivation

The spec already has a great extensibility pattern in the dimension declaration system — you declare an axis name, its allowed modes, and a default. We should apply this same pattern to all name-object fields.

Currently hardcoded in:

  • token.schema.json — nameObject properties (13 semantic + 3 dimension)
  • manifest.schema.jsonconceptOrder enum (13 values)
  • sdk/core/src/validate/spec009.rsENUM_CHECKED_FIELDS
  • sdk/core/src/query.rsNAME_OBJECT_KEYS
  • sdk/core/src/registry.rsfor_field() match statement

Proposed design: Field declarations

A new field.schema.json for declaring name-object fields:

{
  "name": "style",
  "description": "Visual treatment or presentation style",
  "kind": "semantic",
  "registry": "styles.json",
  "validation": "advisory",
  "serialization": { "position": 13 },
  "scope": null,
  "required": false,
  "valueType": "string"
}

Each design system ships a field catalog — a set of these declarations. Spectrum's current 13+3 fields become Spectrum's default catalog. The spec defines the mechanism, not the fields themselves.

Tech analogies considered

  • CSS @property — declare custom properties with type, initial value, inheritance
  • GraphQL schema — each schema declares its own types; engine validates against declarations
  • JSON Schema vocabularies — separate structural validation from keyword definitions
  • Protobuf field numbersserialization.position is analogous
  • Database column catalog — the information_schema pattern

Key properties of a field declaration

Field Type Description
name string Key on the name object
kind semantic / dimension Whether it participates in cascade
registry string or null Registry file for vocabulary validation
validation strict / advisory / none Error vs. warning vs. skip
serialization.position integer Default serialization order
scope string or null Token-type scope (e.g., typography)
required boolean Required on every name object?
valueType string / integer Value type constraint

Impact

Migration path

  1. Create field.schema.json + Spectrum's field catalog (additive)
  2. Update tools to read catalog instead of hardcoding
  3. Update manifest schema — conceptOrder validates against catalog
  4. Reframe taxonomy.md as the mechanism spec

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions