Skip to content

Commit 8e11eff

Browse files
committed
fix(schema): correct metaSchemaURL to decree-schema.json
The constant referenced a singular decree.json that will never be published. The actual artifacts are decree-schema.json (validates *.decree.schema.yaml) and decree-config.json (validates *.decree.config.yaml). Update the URL emitted on schema export to match the schema artifact filename, fix the matching test fixture, and update the design brief's URL pattern + schemastore example to show two catalog entries. Refs #125
1 parent c2c0298 commit 8e11eff

3 files changed

Lines changed: 20 additions & 12 deletions

File tree

.agents/context/schema-spec.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ All changes are **breaking**. Per project policy (no backward compat pre-product
5454
### Final top-level shape (v0.1.0)
5555

5656
```yaml
57-
# yaml-language-server: $schema=https://schemas.opendecree.dev/schema/v0.1.0/decree.json
57+
# yaml-language-server: $schema=https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json
5858

5959
spec_version: v1 # required, const "v1" (the decree format version)
60-
$schema: https://schemas.opendecree.dev/schema/v0.1.0/decree.json # optional
60+
$schema: https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json # optional
6161
$id: urn:decree:schema:payments:v3 # optional
6262
name: payments # required, slug ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
6363
description: Payments service config # optional
@@ -140,22 +140,30 @@ Meta-schema encodes this via `allOf` with 4 `if/then` branches keyed on `type`.
140140

141141
- **Canonical filenames:** `decree.schema.yaml`, `decree.config.yaml`
142142
- **Generic globs:** `*.decree.schema.yaml`, `*.decree.config.yaml` (for repos with multiple schemas)
143-
- **Modeline:** `# yaml-language-server: $schema=https://schemas.opendecree.dev/schema/v0.1.0/decree.json` on line 1 of every example
143+
- **Modeline:** `# yaml-language-server: $schema=https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json` on line 1 of every `*.decree.schema.yaml`; use `decree-config.json` on `*.decree.config.yaml`
144144
- **CLI stays filename-agnostic** — `decree apply some-other-name.yaml` must keep working. The convention drives editor discovery only.
145145

146146
## Publishing
147147

148-
- **URL pattern:** `https://schemas.opendecree.dev/schema/v{MAJOR}.{MINOR}.{PATCH}/decree.json`
148+
- **URL pattern:** two files per version:
149+
- `https://schemas.opendecree.dev/schema/v{MAJOR}.{MINOR}.{PATCH}/decree-schema.json` — validates `*.decree.schema.yaml`
150+
- `https://schemas.opendecree.dev/schema/v{MAJOR}.{MINOR}.{PATCH}/decree-config.json` — validates `*.decree.config.yaml`
149151
- **Pre-stable:** full SemVer in path (`/v0.1.0/`)
150152
- **Post-1.0.0:** switch to major-only paths (`/v1/`) with permanent redirects from historical full-SemVer URLs
151-
- **Hosting:** TBD (GitHub Pages on a dedicated repo, or static-hosted redirect to raw GitHub content). Must be HTTPS, stable, `Content-Type: application/schema+json`.
152-
- **schemastore.org:** PR against `SchemaStore/schemastore` adding entry to `src/api/json/catalog.json`:
153+
- **Hosting:** GitHub Pages on the `opendecree/decree` repo (custom domain `schemas.opendecree.dev` via Cloudflare CNAME, DNS-only). The Pages workflow deploys an explicitly-built `_site/` artifact, so only the `schema/v*/...` files are served; the rest of the repo is not exposed. Content-Type is `application/json` (the issue accepts this as fallback for `application/schema+json`); CORS allows cross-origin (`access-control-allow-origin: *` is the GitHub Pages default for static files). May extract to a dedicated repo if decree's Pages slot is needed for other content.
154+
- **schemastore.org:** PR against `SchemaStore/schemastore` adding **two entries** to `src/api/json/catalog.json`:
153155
```json
154156
{
155157
"name": "OpenDecree Schema",
156-
"description": "OpenDecree configuration schema",
158+
"description": "OpenDecree schema definition (opendecree.dev)",
157159
"fileMatch": ["decree.schema.yaml", "decree.schema.yml", "*.decree.schema.yaml", "*.decree.schema.yml"],
158-
"url": "https://schemas.opendecree.dev/schema/v0.1.0/decree.json"
160+
"url": "https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json"
161+
},
162+
{
163+
"name": "OpenDecree Config",
164+
"description": "OpenDecree configuration values (opendecree.dev)",
165+
"fileMatch": ["decree.config.yaml", "decree.config.yml", "*.decree.config.yaml", "*.decree.config.yml"],
166+
"url": "https://schemas.opendecree.dev/schema/v0.1.0/decree-config.json"
159167
}
160168
```
161169

@@ -191,7 +199,7 @@ Meta-schema encodes this via `allOf` with 4 `if/then` branches keyed on `type`.
191199

192200
### Phase C — Publishing
193201

194-
- #125 — Host meta-schema at `https://schemas.opendecree.dev/schema/v0.1.0/decree.json`
202+
- #125 — Host meta-schemas at `https://schemas.opendecree.dev/schema/v0.1.0/decree-{schema,config}.json`
195203
- #126 — Submit schemastore.org PR
196204

197205
### Phase D — Docs

internal/schema/yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const (
1414
yamlSpecVersionV1 = "v1"
1515
// metaSchemaURL is the canonical URL of the meta-schema that validates
1616
// decree.schema.yaml documents at this spec version. Emitted on export.
17-
metaSchemaURL = "https://schemas.opendecree.dev/schema/v0.1.0/decree.json"
17+
metaSchemaURL = "https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json"
1818
)
1919

2020
// schemaURNPattern matches decree schema URNs: urn:decree:schema:<segment>(:<segment>)*

internal/schema/yaml_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ func TestYAMLValidation_SchemaAndID(t *testing.T) {
307307
})
308308

309309
t.Run("both accepted when well-formed", func(t *testing.T) {
310-
doc, err := unmarshalSchemaYAML([]byte("spec_version: \"v1\"\n$schema: https://schemas.opendecree.dev/schema/v0.1.0/decree.json\n$id: urn:decree:schema:test:v1" + validBody))
310+
doc, err := unmarshalSchemaYAML([]byte("spec_version: \"v1\"\n$schema: https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json\n$id: urn:decree:schema:test:v1" + validBody))
311311
require.NoError(t, err)
312-
assert.Equal(t, "https://schemas.opendecree.dev/schema/v0.1.0/decree.json", doc.Schema)
312+
assert.Equal(t, "https://schemas.opendecree.dev/schema/v0.1.0/decree-schema.json", doc.Schema)
313313
assert.Equal(t, "urn:decree:schema:test:v1", doc.ID)
314314
})
315315

0 commit comments

Comments
 (0)