Skip to content

Schema

Structured MADR uses a JSON Schema (Draft-07) to validate the YAML frontmatter in every ADR. The schema enforces required fields, value constraints, and format rules.

Every Structured MADR document must include the following fields in its YAML frontmatter:

FieldTypeConstraintsDescription
titlestring1-100 charactersShort descriptive title for the decision
descriptionstring1-300 charactersOne-sentence summary of the decision
typestringMust be "adr"Document type identifier
categorystringMin 1 characterDecision category (e.g., architecture, security, api)
tagsarrayMin 1 item, uniqueKeywords for categorization and search
statusenumSee status valuesCurrent status of the decision
createdstringISO 8601 dateCreation date (YYYY-MM-DD)
updatedstringISO 8601 dateLast update date (YYYY-MM-DD)
authorstringMin 1 characterDecision author or team
projectstringMin 1 characterProject identifier
FieldTypeConstraintsDescription
technologiesarrayUnique itemsTechnologies referenced or affected by this decision
audiencearrayUnique itemsIntended readers of this ADR
relatedarrayUnique, pattern ^[a-zA-Z0-9_-]+\.md$Filenames of related ADRs

The status field must be one of:

StatusDescriptionTransitions To
proposedUnder considerationaccepted, superseded
acceptedApproved and activedeprecated, superseded
deprecatedNo longer recommendedsuperseded
supersededReplaced by another ADR(terminal)

Tags must match the pattern ^[a-z0-9][a-z0-9-]*[a-z0-9]$ or be a single lowercase alphanumeric character. This enforces lowercase, hyphen-separated identifiers (e.g., api-design, postgresql, ci-cd).

The schema supports custom extension fields prefixed with x-. This allows teams to add project-specific metadata without violating validation:

---
title: "My Decision"
x-team: platform
x-priority: high
---
---
title: "Use PostgreSQL for Primary Storage"
description: "Decision to adopt PostgreSQL as the primary database"
type: adr
category: architecture
tags:
- database
- postgresql
- storage
status: accepted
created: 2025-01-15
updated: 2025-01-20
author: Architecture Team
project: my-application
technologies:
- postgresql
- rust
audience:
- developers
- architects
related:
- adr_0001.md
---
Terminal window
npx ajv validate -s schemas/structured-madr.schema.json -d your-adr.md
Terminal window
check-jsonschema --schemafile schemas/structured-madr.schema.json your-adr.md
import Ajv from "ajv";
import addFormats from "ajv-formats";
import schema from "./schemas/structured-madr.schema.json";
const ajv = new Ajv();
addFormats(ajv);
const validate = ajv.compile(schema);
const valid = validate(frontmatterObject);

The full JSON Schema file is available at schemas/structured-madr.schema.json in the repository.