
Pkl Has a Free API: Apple's Configuration Language That Catches Errors Before Deployment
YAML doesn't validate. JSON doesn't have comments. TOML doesn't do schemas. Apple built Pkl to fix all three. What Is Pkl? Pkl (pronounced "pickle") is a configuration language from Apple. It's like YAML but with types, validation, and IDE support. // server.pkl port: UInt16 = 8080 host: String = "localhost" maxConnections: UInt = 100 database { host: String = "db.example.com" port: UInt16 = 5432 name: String = "myapp" maxPoolSize: UInt(isBetween(1, 100)) = 20 } If you set port = -1 → compile error. If you set maxPoolSize = 200 → compile error. Before your app even starts. Type Safety // Define a schema class ServerConfig { host: String port: UInt16 ssl: Boolean = false workers: UInt(isPositive) = 4 allowedOrigins: Listing<String> timeouts { read: Duration = 30.s write: Duration = 30.s idle: Duration = 120.s } } // Use it — any mistake is caught at evaluation time production: ServerConfig = new { host = "api.example.com" port = 443 ssl = true workers = 8 allowedOrigins { "https://examp
Continue reading on Dev.to DevOps
Opens in a new tab


