grammarly / omniconf

Configuration library for Clojure that favors explicitness
Apache License 2.0
193 stars 16 forks source link

Q: How to define a multi-valued nested configuration #4

Open anujsrc opened 7 years ago

anujsrc commented 7 years ago

Currently, I am defining a type as :edn. Is there a better way to define such multi-valued parameters where constraint can be applied on each value, like- map keys in the first case and integers in the second case.

alexander-yakushev commented 7 years ago

From a logical standpoint, defining such values as :edn is probably the correct solution, because you are not giving a separate identity to each element of the collection. Perhaps, it would make sense to have something like :list-of, in addition to :nested, but that will create new complicated syntax and semantics for populating such values (e.g. --servers.0.host example.com). I will give it a thought.

Regarding the verification part, you can attach a :verifier to an EDN value and validate the types of the subelements manually. I know, it feels backward but this is the only solution available right now.

anujsrc commented 7 years ago

Thanks @alexander-yakushev - as you mentioned, we can still attach a :verifier, so this is not a blocker. Shall we close this issue or keep it open as a feature request to see if it gets more votes?

alexander-yakushev commented 7 years ago

I will leave this issue open until I figure out if having a nested type for lists is doable and worth doing. Thanks for the idea, Anuj!