Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/sparkly-cows-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@oxa/conformance": patch
"@oxa/core": patch
---

Add @oxa/conformance package for conformance testing
60 changes: 54 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ pnpm typecheck
### Code Generation

```bash
# Run all code generation (validate, ts, py, rs, docs)
# Run all code generation (validate, ts, py, rs, docs, conformance)
pnpm codegen all

# Or run individual steps:
pnpm codegen validate # Validate schema files
pnpm codegen ts # Generate TypeScript types
pnpm codegen py # Generate Python Pydantic models
pnpm codegen rs # Generate Rust types
pnpm codegen docs # Generate MyST documentation
pnpm codegen validate # Validate schema files
pnpm codegen ts # Generate TypeScript types
pnpm codegen py # Generate Python Pydantic models
pnpm codegen rs # Generate Rust types
pnpm codegen conformance # Generate conformance suite manifest
pnpm codegen docs # Generate MyST documentation
```

### Building
Expand Down Expand Up @@ -111,6 +112,53 @@ Commit the generated changeset file with your PR.
- `oxa-types` (TypeScript), `oxa-types` (Python), and `oxa-types` (Rust) stay in sync
- `@oxa/core` and `oxa` can version independently

## Conformance Suite

The `@oxa/conformance` package provides test cases for validating OXA format conversion implementations. If you're building a tool that converts between OXA and other formats, you can use these test cases to validate your implementation.

To add new test cases to the conformance suite:

1. Create a new JSON file in the appropriate directory:
- `packages/@oxa/conformance/cases/inline/` for inline node tests
- `packages/@oxa/conformance/cases/block/` for block node tests

2. Follow the test case format:

```json
{
"$schema": "../../schemas/test-case.schema.json",
"title": "Short descriptive title",
"description": "What this test validates",
"category": "inline",
"formats": {
"oxa": { ... },
"myst": { ... },
"pandoc": { ... },
"stencila": { ... },
"markdown": "...",
"html": "...",
"jats": "..."
},
"notes": {
"markdown": "Optional format-specific notes"
}
}
```

3. Formats should be in canonical order: `oxa`, `myst`, `pandoc`, `stencila`, `markdown`, `html`, `jats`. The `oxa` format is required; others are optional.

4. Regenerate the manifest:

```bash
pnpm codegen conformance
```

5. Run tests to validate your test case:

```bash
pnpm test
```

## Documentation

The documentation uses [MyST](https://mystmd.org) and requires the automated codegen tool to run. To start the documentation use `npm install -g mystmd` and run `myst start` in the `docs/` folder. The online documentation is hosted using Curvenote under https://oxa.dev
75 changes: 75 additions & 0 deletions docs/schema/emphasis.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,78 @@ __children__: __array__ ("Inline")

: The inline content to emphasize.
: See @oxa:inline

### Example

`````{tab-set}
````{tab-item} OXA
:sync: oxa
```json
{"type":"Emphasis","children":[{"type":"Text","value":"emphasized text"}]}
```
````

````{tab-item} MyST AST
:sync: myst-ast
```json
{"type":"emphasis","children":[{"type":"text","value":"emphasized text"}]}
```
````

````{tab-item} Pandoc Types
:sync: pandoc-types
```json
{"t":"Emph","c":[{"t":"Str","c":"emphasized text"}]}
```
````

````{tab-item} Stencila Schema
:sync: stencila-schema
```json
{"type":"Emphasis","content":[{"type":"Text","value":"emphasized text"}]}
```
````

````{tab-item} Markdown
:sync: markdown
```markdown
*emphasized text*
```
````

````{tab-item} MyST Markdown
:sync: myst-markdown
```markdown
*emphasized text*
```
````

````{tab-item} Stencila Markdown
:sync: stencila-markdown
```markdown
*emphasized text*
```
````

````{tab-item} Quarto Markdown
:sync: quarto-markdown
```markdown
*emphasized text*
```
````

````{tab-item} HTML
:sync: html
```html
<em>emphasized text</em>
```
````

````{tab-item} JATS
:sync: jats
```xml
<italic>emphasized text</italic>
```
````

`````
75 changes: 75 additions & 0 deletions docs/schema/heading.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,78 @@ __children__: __array__ ("Inline")

: The inline content of the heading.
: See @oxa:inline

### Example

`````{tab-set}
````{tab-item} OXA
:sync: oxa
```json
{"type":"Heading","level":1,"children":[{"type":"Text","value":"Introduction"}]}
```
````

````{tab-item} MyST AST
:sync: myst-ast
```json
{"type":"heading","depth":1,"children":[{"type":"text","value":"Introduction"}]}
```
````

````{tab-item} Pandoc Types
:sync: pandoc-types
```json
{"t":"Header","c":[1,["",[],[]],[{"t":"Str","c":"Introduction"}]]}
```
````

````{tab-item} Stencila Schema
:sync: stencila-schema
```json
{"type":"Heading","depth":1,"content":[{"type":"Text","value":"Introduction"}]}
```
````

````{tab-item} Markdown
:sync: markdown
```markdown
# Introduction
```
````

````{tab-item} MyST Markdown
:sync: myst-markdown
```markdown
# Introduction
```
````

````{tab-item} Stencila Markdown
:sync: stencila-markdown
```markdown
# Introduction
```
````

````{tab-item} Quarto Markdown
:sync: quarto-markdown
```markdown
# Introduction
```
````

````{tab-item} HTML
:sync: html
```html
<h1>Introduction</h1>
```
````

````{tab-item} JATS
:sync: jats
```xml
<title>Introduction</title>
```
````

`````
75 changes: 75 additions & 0 deletions docs/schema/paragraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,78 @@ __children__: __array__ ("Inline")

: The inline content of the paragraph.
: See @oxa:inline

### Example

`````{tab-set}
````{tab-item} OXA
:sync: oxa
```json
{"type":"Paragraph","children":[{"type":"Text","value":"This is a paragraph."}]}
```
````

````{tab-item} MyST AST
:sync: myst-ast
```json
{"type":"paragraph","children":[{"type":"text","value":"This is a paragraph."}]}
```
````

````{tab-item} Pandoc Types
:sync: pandoc-types
```json
{"t":"Para","c":[{"t":"Str","c":"This is a paragraph."}]}
```
````

````{tab-item} Stencila Schema
:sync: stencila-schema
```json
{"type":"Paragraph","content":[{"type":"Text","value":"This is a paragraph."}]}
```
````

````{tab-item} Markdown
:sync: markdown
```markdown
This is a paragraph.
```
````

````{tab-item} MyST Markdown
:sync: myst-markdown
```markdown
This is a paragraph.
```
````

````{tab-item} Stencila Markdown
:sync: stencila-markdown
```markdown
This is a paragraph.
```
````

````{tab-item} Quarto Markdown
:sync: quarto-markdown
```markdown
This is a paragraph.
```
````

````{tab-item} HTML
:sync: html
```html
<p>This is a paragraph.</p>
```
````

````{tab-item} JATS
:sync: jats
```xml
<p>This is a paragraph.</p>
```
````

`````
Loading