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:

Schema Information

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

  1. Document Validation: When a TCS document is validated against the router schema, it first checks the schema_version field
  2. Version Routing: Based on the version value, it routes to the appropriate Reporting Organisation schema:
  3. 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:

  1. The new version in the enum list
  2. 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"
      }
    }
  ]
}

Resources