Skip to content

Commit cf5c5b2

Browse files
committed
feat(conformance): add schemas and generated typedefs
1 parent 498e608 commit cf5c5b2

7 files changed

Lines changed: 303 additions & 9 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@changesets/cli": "^2.29.8",
3030
"@eslint/js": "^9.39.2",
3131
"eslint": "^9.39.2",
32+
"json-schema-to-typescript": "^15.0.4",
3233
"prettier": "^3.7.4",
3334
"tsx": "^4.21.0",
3435
"turbo": "^2.0.0",

packages/oxa-conformance/manifest.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,36 @@
22
"$schema": "./schemas/manifest.schema.json",
33
"version": "0.1.0",
44
"formats": ["oxa", "myst", "pandoc", "stencila", "markdown", "html", "jats"],
5-
"cases": []
5+
"cases": [
6+
{
7+
"id": "emphasis-basic",
8+
"path": "cases/inline/emphasis-basic.json",
9+
"category": "inline",
10+
"nodeTypes": ["Emphasis", "Text"]
11+
},
12+
{
13+
"id": "strong-basic",
14+
"path": "cases/inline/strong-basic.json",
15+
"category": "inline",
16+
"nodeTypes": ["Strong", "Text"]
17+
},
18+
{
19+
"id": "text-basic",
20+
"path": "cases/inline/text-basic.json",
21+
"category": "inline",
22+
"nodeTypes": ["Text"]
23+
},
24+
{
25+
"id": "heading-basic",
26+
"path": "cases/block/heading-basic.json",
27+
"category": "block",
28+
"nodeTypes": ["Heading", "Text"]
29+
},
30+
{
31+
"id": "paragraph-basic",
32+
"path": "cases/block/paragraph-basic.json",
33+
"category": "block",
34+
"nodeTypes": ["Paragraph", "Text"]
35+
}
36+
]
637
}

packages/oxa-conformance/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
"description": "Conformance test suite for OXA schema implementations",
55
"type": "module",
66
"main": "./index.js",
7+
"types": "./index.d.ts",
78
"exports": {
89
".": {
10+
"types": "./index.d.ts",
911
"import": "./index.js",
1012
"require": "./index.cjs"
1113
},
@@ -16,6 +18,7 @@
1618
"files": [
1719
"index.js",
1820
"index.cjs",
21+
"index.d.ts",
1922
"manifest.json",
2023
"cases",
2124
"schemas",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://oxa.dev/schemas/conformance/manifest.schema.json",
4+
"title": "OXA Conformance Suite Manifest",
5+
"description": "Index of all test cases in the OXA Conformance Suite",
6+
"type": "object",
7+
"properties": {
8+
"$schema": {
9+
"type": "string",
10+
"description": "Reference to this schema"
11+
},
12+
"version": {
13+
"type": "string",
14+
"description": "Version of the conformance suite",
15+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
16+
},
17+
"formats": {
18+
"type": "array",
19+
"description": "List of supported formats in canonical order",
20+
"items": {
21+
"type": "string",
22+
"enum": ["oxa", "myst", "pandoc", "stencila", "markdown", "html", "jats"]
23+
}
24+
},
25+
"cases": {
26+
"type": "array",
27+
"description": "List of all test cases",
28+
"items": {
29+
"type": "object",
30+
"properties": {
31+
"id": {
32+
"type": "string",
33+
"description": "Unique identifier for the test case (derived from filename)"
34+
},
35+
"path": {
36+
"type": "string",
37+
"description": "Relative path to the test case file"
38+
},
39+
"category": {
40+
"type": "string",
41+
"enum": ["inline", "block", "document", "edge-case"],
42+
"description": "Category of the test case"
43+
},
44+
"nodeTypes": {
45+
"type": "array",
46+
"description": "OXA node types covered by this test case",
47+
"items": {
48+
"type": "string"
49+
}
50+
}
51+
},
52+
"required": ["id", "path", "category", "nodeTypes"],
53+
"additionalProperties": false
54+
}
55+
}
56+
},
57+
"required": ["version", "formats", "cases"],
58+
"additionalProperties": false
59+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://oxa.dev/schemas/conformance/test-case.schema.json",
4+
"title": "OXA Conformance Test Case",
5+
"description": "A test case for validating OXA format conversions",
6+
"type": "object",
7+
"properties": {
8+
"$schema": {
9+
"type": "string",
10+
"description": "Reference to this schema"
11+
},
12+
"title": {
13+
"type": "string",
14+
"description": "Short title describing the test case"
15+
},
16+
"description": {
17+
"type": "string",
18+
"description": "Detailed description of what the test case validates"
19+
},
20+
"category": {
21+
"type": "string",
22+
"enum": ["inline", "block", "document"],
23+
"description": "Category of the test case"
24+
},
25+
"formats": {
26+
"type": "object",
27+
"description": "Format representations of the same content. OXA is always required and should be first.",
28+
"properties": {
29+
"oxa": {
30+
"type": "object",
31+
"description": "OXA JSON representation (required, authoritative)",
32+
"additionalProperties": true
33+
},
34+
"myst": {
35+
"type": "object",
36+
"description": "MyST Markdown AST representation",
37+
"additionalProperties": true
38+
},
39+
"pandoc": {
40+
"type": "object",
41+
"description": "Pandoc AST JSON representation",
42+
"additionalProperties": true
43+
},
44+
"stencila": {
45+
"type": "object",
46+
"description": "Stencila Schema JSON representation",
47+
"additionalProperties": true
48+
},
49+
"markdown": {
50+
"type": "string",
51+
"description": "CommonMark/GFM Markdown representation"
52+
},
53+
"html": {
54+
"type": "string",
55+
"description": "Semantic HTML5 representation"
56+
},
57+
"jats": {
58+
"type": "string",
59+
"description": "JATS Publishing XML representation"
60+
}
61+
},
62+
"required": ["oxa"],
63+
"additionalProperties": false
64+
},
65+
"notes": {
66+
"type": "object",
67+
"description": "Format-specific notes and considerations",
68+
"additionalProperties": {
69+
"type": "string"
70+
}
71+
}
72+
},
73+
"required": ["title", "category", "formats"],
74+
"additionalProperties": false
75+
}

pnpm-lock.yaml

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)