> ## Documentation Index
> Fetch the complete documentation index at: https://typewall.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema Export

> Emit JSON Schema 2020-12 and OpenAPI 3.1 documents

`to_json_schema()` emits JSON Schema 2020-12. `to_openapi_schema()` emits an OpenAPI 3.1-compatible schema object.

```python theme={null}
from typewall import to_json_schema, w

schema = w.object({"name": w.str().min(2), "age": w.int().optional()})
document = to_json_schema(schema)
assert document["$schema"].endswith("2020-12/schema")
```

> [!WARNING]
>
> Non-representable refinements and transforms raise `SchemaExportError` rather than producing a misleading contract.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.