Open sblaisot opened 1 year ago
@sblaisot I agree that the lack of comments in JSON is annoying. I originally picked json because it was included in both python and javascript without the need for any third party libraries. However, we now have a standard mechanism (environment.yml) to load third party python libraries in python, so that reason is no longer relevant.
However, this is also not a very high priority for the OpenPATH team - which is focused on the admin dashboard, UI improvements, and server scalability.
However, we would welcome contributions to make this change, even if they are incremental - one config file at a time 😄
I do still prefer raw JSON for the dynamic config (e.g. https://github.com/e-mission/nrel-openpath-deploy-configs) because then I can limit the number of external javascript libraries that we need to load for the really simple webapps such as https://github.com/e-mission/nrel-openpath-join-page/
e-mission server uses json configuration files. However, Json is not a friendly config file format as it is a data-only file format that doesn't allow for comments.
Currently, comments are inserted in config files as
__comment
object keys but that lead to duplicate object keys as in https://github.com/e-mission/e-mission-server/blob/master/conf/net/api/webserver.conf.sample#L10-L18RFC 8259 (The JavaScript Object Notation (JSON) Data Interchange Format), section 4 states that :
Duplicate object keys lead to undefined behaviour across systems (currently python
json.load()
is permissive and only keep last value so it basically appears to work by ignoring all but last comment)Switching to a more config-friendly format with rich data structures like Yaml or Toml in the future appears to be a nice move.