treeform / jsony

A loose, direct to object json parser with hooks.
MIT License
270 stars 34 forks source link

fix #52: allow enum keys when parsing tables #56

Closed pietroppeter closed 7 months ago

pietroppeter commented 1 year ago

currently jsony can only parse Table with string keys but ~I do not see any problem to allow a generic key~ enum should be fine too. this fixes #52. added two test case for enum, the second of which replicates issue #52 (enum key). edited to remove possibility of generic keys.

pietroppeter commented 1 year ago

You are right, somehow I got convinced you could have any key (I am working on a yaml parser based on this, so things got mixed up ;)), thanks for the remark! I could fix to only allow string and enum as table keys. Suggestions welcome.

pietroppeter commented 1 year ago

fixed to restrict only to string and enum case.

pietroppeter commented 1 year ago

Not sure if the CI failure (failure when testing with js backend) is related to this fix, at the moment I do not have node locally to test it.

treeform commented 1 year ago

I think your PR fails to due to issue: https://github.com/nim-lang/Nim/issues/21317

ringabout commented 1 year ago

fixed => https://github.com/nim-lang/Nim/pull/21320

pietroppeter commented 1 year ago

If CI is approved I would expect it to be green

pietroppeter commented 1 year ago

CI is green and ready to merge if approved

pietroppeter commented 1 year ago

sorry it took a while to address your comment, in the end the code was fine as it was but it took me a moment to realize that (see resolved comment above).