coot/purescript-argonaut-aeson-generic

Conflicting information on allNullaryToStringTag option

Opened this issue · 3 comments

The README says:

Generic codec for aeson generic encoding (only supporting defaultOptions with allNullaryToStringTag set to true).

However, the documentation for genericEncodeAeson says:

Encode any Generic data structure into Json using Aeson encoding (with allNullaryToStringTag set to False)

What should we be setting allNullaryToStringTag to in Haskell?

Also, these lines in the tests suggest that the "only supporting defaultOptions" part in the README isn't true, since it looks like sumEncoding and tagSingleConstructors is configurable.

Thank you for pointing out this inconsistency in documentation.

Previously, encoding was inconsistent in some cases. I am working on fixing it and my goal is to make both tagSingleConstructors and allNullaryToStringTag configurable.

Currently, you should use defaultOptions {allNullaryToStringTag = False} on the Haskell side because of #5, but you may set tagSingleConstructors to either True or False as you like, insofar as it is in agreement between the Haskell and the PureScript side. Once I get the fix done in #7, you would be able to set any of the two flags to any value, and in particular encoding with defaultOptions would work in all cases.

I would appreciate if you keep me in awareness of further issues you may encounter so that we may sort them all out for good.

Paul @paulyoung — the feature I mentioned previously is now merged to master, available as version 0.2.0, and documentation has been fixed as part of it. Hope you enjoy using it. Please report any other issues you may notice.