Skip to content

Config file shape

Kayan expects a root object with a required flavors object. Top-level keys outside flavors and targets act as defaults for every flavor. An optional root-level targets object can refine those defaults for specific targets such as android, ios, or jvm.

This page shows the JSON form of the shape. YAML uses the same structure and resolution rules.

JSON input must use valid JSON syntax in both SUBSET and STRICT validation modes, including in keys that a module does not consume. Strings and object keys must be double-quoted. Unquoted strings, malformed numbers such as 01, +1, or 1., and non-JSON literals such as NaN are rejected with a syntax error naming the source file. JSON escapes, Unicode, and exponent notation such as 1.5e-2 are supported; numeric values must be finite.

JSON and YAML reject duplicate keys within any object, including defaults, flavors, targets, and map values, in both SUBSET and STRICT validation modes. JSON compares decoded keys, so "value" and "\u0076alue" count as the same key. Errors identify the source file and, for JSON duplicates, the key’s path. The same key can appear in separate objects or files; normal layering still applies.

{
"targets": {
"ios": {
"brand_name": "Example iOS"
}
},
"flavors": {
"prod": {
"bundle_id": "com.example.app",
"feature_search_enabled": false,
"targets": {
"ios": {
"bundle_id": "com.example.app.ios"
}
}
},
"dev": {
"bundle_id": "com.example.app.dev",
"feature_search_enabled": true
}
},
"brand_name": "Example App",
"api_base_url": "https://api.example.com"
}

Flavor objects accept the same keys as the top-level defaults section, plus an optional targets object with the same per-target shape.

An optional override file uses the same shape. It can replace top-level defaults, target defaults, flavor values, and flavor-target values.

flavors and targets are reserved by Kayan and cannot be declared as schema entries. All other config keys should be declared in kayan { schema { ... } } when the module consumes them.

With the Gradle plugin’s default KayanValidationMode.SUBSET, undeclared keys are ignored by that module. With KayanValidationMode.STRICT, undeclared keys fail validation.

Target overlays only affect generated values when Kayan is asked to resolve a target. For KMP expect / actual generation and target-aware buildValue(), see Target-specific generation.