Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anujsrc opened this issue Mar 21, 2017 · 3 comments
Open

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

anujsrc opened this issue Mar 21, 2017 · 3 comments

Comments

@anujsrc
Copy link

anujsrc commented Mar 21, 2017

  • Version: 0.2.5
  • Type: Query/Clarification to understand if there is a better way to define multi-valued configs
  • Summary: Need to define a validated configuration for parameters that may take nested params, like-
    • [{:host "192.168.4.40" :port 9092}]
    • [6379 6380]

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
Copy link
Contributor

alexander-yakushev commented Mar 21, 2017

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
Copy link
Author

anujsrc commented Mar 21, 2017

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
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants