TCS Router Schema
The Router Schema (index.json
) serves as the entry point for the Technology Carbon Standard, directing validation to the appropriate version of the Reporting Organisation schema based on the document’s schema version.
Purpose
The Router Schema provides:
- Version Management: Routes documents to the correct schema version for validation
- Future-Proofing: Allows for seamless addition of new schema versions
- Backward Compatibility: Maintains support for older schema versions
- Single Entry Point: Provides a consistent validation endpoint regardless of document version
Schema Information
- Schema ID:
https://techcarbonstandard.org/schemas/index.json
- Current Supported Versions:
0.1.0
,0.0.1
- Schema Type: Router/Dispatcher
Schema Structure
The Router Schema is intentionally minimal, containing only the routing logic:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://techcarbonstandard.org/schemas/index.json",
"title": "Technology Carbon Standard Root Schema",
"description": "Root schema that routes validation to the appropriate version of the Technology Carbon Standard",
"type": "object",
"properties": {
"schema_version": {
"type": "string",
"description": "Version of the root Technology Carbon Standard report schema being used",
"enum": ["0.1.0", "0.0.1"]
}
},
"required": ["schema_version"],
"allOf": [
{
"if": {
"properties": {
"schema_version": { "const": "0.1.0" }
}
},
"then": {
"$ref": "https://techcarbonstandard.org/schemas/reporting_organisation/v0.1.0.json"
}
},
{
"if": {
"properties": {
"schema_version": { "const": "0.0.1" }
}
},
"then": {
"$ref": "https://techcarbonstandard.org/schemas/reporting_organisation/v0.0.1.json"
}
}
],
"additionalProperties": true
}
How It Works
- Document Validation: When a TCS document is validated against the router schema, it first checks the
schema_version
field - Version Routing: Based on the version value, it routes to the appropriate Reporting Organisation schema:
"0.1.0"
→ Routes toreporting_organisation/v0.1.0.json
"0.0.1"
→ Routes toreporting_organisation/v0.0.1.json
- Validation Delegation: The actual validation is performed by the target schema
Required Fields
Field | Type | Required | Description |
---|---|---|---|
schema_version | string (enum) | Yes | Must be one of the supported versions: “0.1.0” or “0.0.1” |
Usage Example
Any valid TCS document must start with a schema version declaration:
{
"schema_version": "0.1.0",
"organisation": {
"organisation_name": "Example Corp"
},
"emissions_reports": [...]
}
Adding New Versions
When new schema versions are released, the router schema is updated to include:
- The new version in the
enum
list - A new conditional routing rule in the
allOf
section
Example of adding version 0.2.0
:
{
"properties": {
"schema_version": {
"enum": ["0.2.0", "0.1.0", "0.0.1"]
}
},
"allOf": [
{
"if": {
"properties": {
"schema_version": { "const": "0.2.0" }
}
},
"then": {
"$ref": "https://techcarbonstandard.org/schemas/reporting_organisation/v0.2.0.json"
}
}
]
}
Related Documentation
- Reporting Organisation Schema v0.1.0
- Emissions Report Schema v0.0.1
- Tech Carbon Standard Schema v0.0.1
- Implementation Guide