Extending the schema — DSDS 0.23.1
Three ways to go beyond what the spec ships with — $extensions for tool-specific data, custom kinds for a kind of document the spec doesn't have, and profiles for making an existing kind's optional fields required.
DSDS ships with a fixed set of kinds, and a fixed set of fields on each. Sooner or later, every real project needs more than that — data a specific tool wants to store, a document type the spec has no name for, or fields that should be required instead of just optional. This page covers the three ways to get there, and when to reach for each one.
| Mechanism | What it's for | Who else can read it |
|---|---|---|
| Data a specific tool needs, attached to something the spec already models | Only the tool that owns the namespace — everyone else skips it, by design | |
| A custom kind | A kind of document the spec has no name for at all | Nobody, unless you also publish the schema that defines it |
| A profile | Making an existing kind's optional fields required, for your own project | Everybody — the document is still fully standard DSDS |
#
Every top-level key under
#
Why item-level A
sections:
- kind: guidelines
for: human
items:
- level: should
statement: Limit each surface to one primary button.
$extensions:
com.acme:
rationale: Multiple primary buttons compete for attention and force the user to guess which action is actually the recommended one.
failureMode: A dialog ships with two primary-styled buttons (e.g. "Save" and "Save as draft"), and usability testing shows users default to the wrong one.
A tool that doesn't know about
See it in the repo's own
#
Custom kindsWhen the generic
kind: acme.excerpt
id: acme-excerpt-onboarding
name: Onboarding excerpt
description: A short, reusable pull-quote of onboarding copy, shared across three different surfaces.
A custom entry kind (
That's the tradeoff with a custom kind: total freedom over the fields, but total unfamiliarity to every other tool. It's the right choice for a document type that's genuinely yours and nobody else's. It's the wrong choice for making a kind the spec already defines stricter — for that, use a profile instead.
Renaming
#
ProfilesA profile is a small, local schema file that turns some of a kind's optional fields into required ones, just for your own project. It never adds a new field — it can only make an existing rule stricter.
That one property is what makes a profile safe to build on: a profile may narrow. It must not extend. A document that passes your profile is still a fully valid DSDS document to any tool that's never heard of your profile — nothing is added, nothing is different, just a stricter bar for your own project to clear.
A profile is built with JSON Schema's
This isn't a new idea — other standards use the same pattern to narrow a shared format for one group's needs (the EU's DCAT-AP metadata standard is one example). DSDS didn't need to invent a mechanism for this:
#
The Save a file at
A profile file needs its own
# profiles/entries/component.schema.yaml
$schema: https://json-schema.org/draft/2020-12/schema
$id: https://your-org.example/profiles/entries/component.schema.yaml
title: Acme's stable-component profile
description: Once a component's status is stable, it must have documentation sections and at least one source file.
allOf:
- $ref: https://designsystemdocspec.org/v0.23.1/entries/component.schema.yaml
- if:
required: [metadata]
properties:
metadata:
required: [status]
properties:
status:
required: [status]
properties:
status: {const: stable}
then:
required: [sections, sourceFiles]
This is the most useful form of profile: if the status is stable, then require these fields. It works on anything with a lifecycle field — a component, a token, a theme — and turns "is the documentation complete?" from a question someone has to remember to ask into something the build checks automatically.
#
What a profile can't doA profile can't add a field. If your organization needs a field the spec truly doesn't have anywhere — not "optional and currently empty," but genuinely missing — that's not a job for a profile. Use
#
Things people often want to addBefore reaching for
- A prop table. Point a tool at the real source instead — a component's
sourceFiles (or, for an already-generated manifest,specs ). - An anatomy diagram. Anatomy is prose about parts, the same job
definitions already does. Use adefinitions section withcontext: anatomy . - A
token-group kind. A group is a fact about its members, not a fourth kind. Setmetadata.group on each token instead. - Typed accessibility fields (
wcagLevel , ARIA facts). Treat accessibility guidance as ordinary guidance: aguidelines item withevidence pointing at the WCAG criterion, andchecks pointing at the test that verifies it. - Separate relationship/link/reference types. One type already covers it —
common/ref :to /href plusrel . - A migration guide. Each schema file's own
$comment carries the reasoning; theCHANGELOG has the field-by-field mapping.
Still missing something after checking this list? That's what the rest of this page is for:
- A rationale or failure-mode field on a guideline item — this is exactly what item-level
$extensions is for. - Anything else genuinely absent — a custom kind, or a profile, depending on whether you're naming a new kind of document or tightening an existing one.
#
Choosing between the three- Attaching data a specific tool needs, to something the spec already models?
$extensions . - Documenting something the spec has no place for at all — and you're fine with no other tool understanding it? A custom kind.
- Making optional fields mandatory for your own project, without leaving standard DSDS? A profile.
You can combine them. A custom kind can carry its own