Config Schema Language

Type-Safe Configuration Schema with Human-Friendly Syntax

Why Choose CSL?

🔒 Type Safety

Enforce types with familiar syntax: string, number[], "dev"|"prod"

🔍 Rich Validation

Inline annotations like @range(1-100) and constraint blocks for complex rules

🧩 Flexible Structures

Nested tables, wildcard keys (*: type), and any types

config AppConfig {
  app_name: string;
  version: string @regex("^\\d+\\.\\d+");
  environment: "dev" | "prod" = "dev";

  database: {
    host: string @format(url);
    port: number @range(1024, 65535);
    ssl?: boolean;
  };

  constraints {
    conflicts database.ssl with insecure_mode;
    requires database.ssl => environment == "prod";
  }
}

First-Class Tooling

💡 IDE Support

Autocomplete, linting, and inline documentation

✅ Validation CLI

Instant config validation with rich error reporting

📚 Docs Generator

Automatically generate human-readable documentation

Get Started with CSL

Step 1

Build From Source

Build a CSL implementation:

git clone https://github.com/nullptr-0/toml.git
cd toml
cmake -B build -S .
cmake --build build
Step 2

Create Your First Schema

Start with basic type definitions:

config AppConfig {
  app_name: string;
  port: number @range(1, 65535);
  features: string[];
}
Step 3

Validate Configurations

Check your configuration files:

./build/toml --parse production.toml --validate config.csl

Found a bug? Report in issues. CSL | TOML

Key Features to Explore

🔗 Type Unions

method: "GET" | "POST"

⚖️ Constraints

requires ssl => port == 443

🌐 Wildcards

*: { path: string }