finos / finos/calm-schema

Calm Schema Change Proposal - ADR Support

Open
#7 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Target Schema:

* Add new schema file: `adr.json` (MADR-mapped JSON).
* Update existing `adrs` arrays in `core.json` to reference the new definition.

### Background

As part of version 1.0, support for ADR URLs was added via [Add ADRs to core.json finos/architecture-as-code#1224](https://github.com/finos/architecture-as-code/issues/1224) with rendering in calm-hub via [Displaying ADR Details finos/architecture-as-code#1328 ](https://github.com/finos/architecture-as-code/pull/1328).
In [Office Hours 2025-07-31](https://github.com/finos/architecture-as-code/issues/1474) we discussed schema-level ADR support but deferred.
In [Office Hours 2025-10-30](https://github.com/finos/architecture-as-code/issues/1764) we agreed to reconsider this in the next schema update.

### Requirement

Reopen ADR support with a MADR-based approach. Authors continue using standard MADR 4.0.0 Markdown, while CALM gains an optional JSON serialization for validation, indexing, and rendering.

### References

* **Code definition (current VM shape):** [https://github.com/finos/architecture-as-code/blob/main/shared/src/view-model/adr.ts](https://github.com/finos/architecture-as-code/blob/main/shared/src/view-model/adr.ts)
* **Earlier mapping discussion with proposal based on current definition in project:** [https://github.com/finos/architecture-as-code/issues/1224#issuecomment-3141243236](https://github.com/finos/architecture-as-code/issues/1224#issuecomment-3141243236)
* **MADR template (Markdown only):** [https://github.com/adr/madr/tree/4.0.0/template](https://github.com/adr/madr/tree/4.0.0/template)

### Rationale

* Keep CALM aligned with MADR as the canonical authoring format given popularity in industry
* Allow either a URL to a MADR document or a JSON object per ADR CALM definition.

### Proposed Schema Changes

1. **New file:** `adr.json` (MADR-mapped)
`oneOf`:

* `string` → URL to external MADR Markdown
* `object` → structured fields mapped 1:1 to MADR sections (status, drivers, options, outcome, links, timestamps, etc.)

2. **Update optional ADR arrays**

* In `core.json` (root):

```json
{
"adrs": {
"type": "array",
"items": { "$ref": "https://calm.finos.org/release/1.1/meta/adr.json" }
}
}
```

### Use Cases

* **Enterprise Architect:** attach rationale to architectures and timeline moments.
* **Developer:** see trade-offs and chosen options in tools while keeping Markdown ADRs.
* **Auditor/PM:** trace decisions, status (Proposed/Accepted/etc.), and supersessions.
* **Pattern Author:** capture decisions for patterns as well as implementations.

### Current Limitations

* MADR 4.0.0 is Markdown-only; CALM lacks a native JSON shape for validation and search.

### Backward Compatibility

* Fully additive/optional; existing documents remain valid.
* URL-only ADRs keep working via the `string` branch.

### Validation Strategy

* Add sample ADRs (URL + JSON) and schema tests for `adr.json`.
* Ensure existing tooling works as before assuming users maintain using adr url

### Subsequent Tooling Enhancements

* CALM Models: Create new ADR model in the calm-models module.
* CLI validate: resolve/validate ADR JSON entries; tolerate URL entries.
* CLI template/docify: add additional rendering support in Widget Framework
* VSCode Extension:
* **Docs:** authoring guide (MADR as source, JSON as CALM serialization)

### Version Strategy

* Minor, non-breaking addition to the 1.x schema line.

### Implementation Checklist

* [ ] Draft `adr.json` (MADR-mapped) and validate
* [ ] Update `calm.json` to reference `adr.json` (optional `adrs` array)
* [ ] (If applicable) add `adrs` to `calm-timeline.json` moments
* [ ] Example ADRs (Markdown URL + JSON)
* [ ] CLI + UI rendering updates
* [ ] Documentation (authoring + mapping + interop)
* [ ] Tests (unit + integration)

### Alternative Solutions

1. **Define a new CALM-standard ADR format (if required)**
*Pros:* Full control; tailored to CALM; can extend beyond MADR (e.g., link controls, risks, releases).
*Cons:* Diverges from a widely known template; higher authoring friction; migration cost.

There are other ADR templates mentioned on the git repo - https://adr.github.io/adr-templates/

2. **Encourage MADR to publish an official JSON schema/mapping**
*Pros:* Keeps community alignment; CALM uses a standard JSON representation; reduces maintenance burden.
*Cons:* External dependency on MADR release cadence; mapping details may require negotiation (naming, enums, timestamps).

Contributor guide

Open the contributing guide

Research direction

Start with the current VM shape in shared/src/view-model/adr.ts, the MADR 4.0.0 template, and the existing adrs definitions in core.json. Draft adr.json with URL and structured-object branches, update the relevant schema references, and add the proposed URL and JSON samples. Done means schema tests validate both forms while existing URL-only documents remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.