Schema Maintenance
This directory contains YAML schema definitions that are used to generate schema documentation pages.
How It Works
- YAML Schema Files (
*.yml) - Single source of truth for data schemas - TypeScript Schema Files (
src/schemas/*.ts) - Generated from YAML for use in React components - MDX Documentation Pages - Import and render schemas using the
SchemaTablecomponent
Adding a New Schema
1. Create YAML Schema File
Create a new YAML file in docs/schemas/ with the following structure:
table_name:
name: Display Name
description: Table description
location: Optional S3 or database location
fields:
- name: field_name
type: string|int|boolean|array
required: true|false
description: Field description
2. Generate TypeScript Schema
Convert the YAML to a TypeScript file in src/schemas/:
export const schemaName = {
table_name: {
name: "Display Name",
description: "Table description",
location: "s3://...",
fields: [
{ name: "field_name", type: "string", required: true, description: "..." },
// ...
]
},
// ...
};
3. Create MDX Documentation Page
Create a new .mdx file in the appropriate docs directory:
---
sidebar_position: 4
---
import SchemaTable from '@site/src/components/SchemaTable';
import { schemaName } from '@site/src/schemas/schemaName';
# Schema Name
Description...
## Table Section
<SchemaTable schema={schemaName.table_name} />
Updating an Existing Schema
- Edit the YAML file in
docs/schemas/ - Regenerate the TypeScript file in
src/schemas/ - The MDX page will automatically reflect the changes
Example: Sailthru
- YAML:
docs/schemas/sailthru.yml - TypeScript:
src/schemas/sailthru.ts - Documentation:
docs/Data Delivery/Sailthru Schema.mdx - Referenced from:
docs/Data Delivery/Feedback.md
Future Improvements
Consider automating the YAML → TypeScript conversion with a build script.