We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Either
value
contents
Unsure if this belongs to argonaut-aeson-generic, or Argonaut.
argonaut-aeson-generic
Here's a few test datatypes in PureScript:
data TestSum = Nullary | Bool Boolean | Int Int | Number Number data TestData = TMaybe (Maybe TestSum) | TEither String newtype Foo = Foo { _fooE :: Either String Int , _fooTestSum :: TestSum , _fooTestData :: TestData }
and test value:
testFoo = Foo { _fooE: Left "foo" , _fooTestSum: Nullary , _fooTestData: TEither "foo" }
Options are:
ops :: Options ops = Options { sumEncoding: TaggedObject { tagFieldName: "tag", contentsFieldName: "contents" } , tagSingleConstructors: true , allNullaryToStringTag: true }
Encoding to JSON:
z = genericEncodeAeson ops testFoo log $ stringify $ z
the result is:
{ "_fooTestSum": { "tag": "Nullary" }, "_fooTestData": { "tag": "TEither", "contents": "foo" }, "_fooE": { "tag": "Left", "value": "foo" } }
The made-up type TEither correctly uses "contents". The standard library Either uses "value".
TEither
"contents"
"value"
I think this breaks compatibility with Aeson on the Haskell side, which uses "contents" for all datatypes.
It looks like Argonaut is picking up the encoding options from somewhere else, for the Either.
I am trying to update Purescript Bridge using argonaut-aeson-generic: eskimor/purescript-bridge#89
The text was updated successfully, but these errors were encountered:
key
This might be fixed by overriding https://github.com/purescript-contrib/purescript-argonaut-codecs/blob/50e79f6cd526f875a1e93477aafd4ed98f270266/src/Data/Argonaut/Decode/Decoders.purs#L69 to make it consistent with https://hackage.haskell.org/package/aeson-2.2.1.0/docs/Data-Aeson.html#v:defaultTaggedObject
Sorry, something went wrong.
I think related to #6
No branches or pull requests
Unsure if this belongs to
argonaut-aeson-generic
, or Argonaut.Here's a few test datatypes in PureScript:
and test value:
Options are:
Encoding to JSON:
the result is:
The made-up type
TEither
correctly uses"contents"
. The standard libraryEither
uses"value"
.I think this breaks compatibility with Aeson on the Haskell side, which uses
"contents"
for all datatypes.It looks like Argonaut is picking up the encoding options from somewhere else, for the
Either
.I am trying to update Purescript Bridge using
argonaut-aeson-generic
: eskimor/purescript-bridge#89The text was updated successfully, but these errors were encountered: