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 do you decode dictionary keys that vary? #60

Open
sanikolov opened this issue Jan 28, 2022 · 0 comments
Open

Q: how do you decode dictionary keys that vary? #60

sanikolov opened this issue Jan 28, 2022 · 0 comments

Comments

@sanikolov
Copy link

Consider a web request for 1 or more of 3 keys that are known ahead of time - foo, bar, cow.

curl "http://host/getme?key=foo,cow"
{"foo": "val1", "cow": "val2"}   # bar is missing because we didn't ask for it

A typical record type definition won't work because we may or may not get the all the keys in the json reply.
I looked in the docs and the closest match were union (sum) types but are they able to solve this? Not seeing how.

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

No branches or pull requests

1 participant