NREL / routee-compass

An energy-aware routing engine
https://nrel.github.io/routee-compass/
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

Implement TOML InjectFormat for Inject Input Plugin #182

Open robfitzgerald opened 7 months ago

robfitzgerald commented 7 months ago

there's a placeholder to inject TOML data in the Inject plugin's value argument but it is not implemented in the corresponding InputFormat enum. providing this would allow for idiomatic TOML injections instead of quote-escaped JSON values. the latter is difficult to read, often exceeding the text window column width, and our IDEs cannot validate it since it is treated as a string. as TOML, it becomes vertical, flatter and easier to be read by a human.

[[plugin.input_plugins]]
type = "inject"
format = "json"
key = "grid_search"
value = '{"a": 123456, "b": 126897, "c": { "something": [1, 2, 3] } }'

instead, as TOML:

[[plugin.input_plugins]]
type = "inject"
format = "toml"
key = "grid_search"
[plugin.input_plugins.value]
a = 123456
b = 126897
[plugin.input_plugins.value.c]
something = [1, 2, 3]