Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[config-dev] Config path separator syntax in the API

On today's call, the last point of discussion was the topic of having an API-level syntax for config path navigation.

The problem is that specifying (at an API level) that the "." character is the canonical path separator character is that it becomes quite inconvenient for use cases where (for example) a configuration path segment itself contains a ".".  In fact the same problem applies to other potential candidates for a configuration path separator such as "/" or ":" or ";".

Given this problem and that few actual configuration syntaxes appear to utilize the "." character as a separator (properties and TOML are all that come to mind), I would propose that we do not specify any separator character at an API level and instead make it be purely a concern of the configuration source/parser.  At an API level, the key syntax should ideally be allowed to be any string (with the /possible/ exception of the empty string).

To allow easy navigation of the configuration tree by users, I'd instead suggest an API similar to one of the following:

   config.get("key1", "key2", "key3").asInt();

Feel free to follow up here or on next week's call.  Thanks!
- DML • he/him

Back to the top