Skip to content

Derived ToJSON1 instance does not respect omitNothingFields = True #687

@ejconlon

Description

@ejconlon

For an instance

data C a = C { required :: a, optional :: Maybe a }
    deriving (Eq, Show, Generic1)
    deriving (ToJSON1) via (AesonWrapper1 C)

with a simple deriving via newtype wrapper AesonWrapper1 I am seeing the value C 1 Nothing serialize with null

        Example test case: FAIL
          Repro.hs:77:
          expected: "{\"required\":1}"
           but got: "{\"required\":1,\"optional\":null}"

See https://gist.github.com/ejconlon/30dc50b183a0f72501c3e49ce57cae52 for a self-contained repro.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions