OxL Справочник OxL
РусскийEnglish

error config-type

error Стандарт: [§14.1]

Тип поля конфига нельзя прочитать из текста конфигурации.

What it means#

A config is filled from text: command-line flags (--set App.port=8080), environment variables, config/<profile>.toml (§14.1). Every field must therefore have a type with a textual form: numbers, bool, char, str, Duration ("250ms", "1h30m"), plain enums (the variant name), List<T>, an optional T?, data records of such fields, distinct/refined types over them, and secret<T>. Maps, sets, tuples, functions, unions other than T?, enums with fields, time points (Time, Date, …), generic data and other configs have no textual form (D-2705).

Example#

oxl✓ проверяется в CI
config App {
  limits: Map<str, i32>      // <- config-type
  shape: (i32, i32) = (1, 2)
}
error
config-type

How to fix#

Use a type that can be written as text: replace the map by a List of data records, the tuple by a data with two fields, an enum with fields by a plain enum plus separate fields.

oxl✓ проверяется в CI
data Limit { name: str; max: i32 }

config App {
  limits: List<Limit> = []
}

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства