Skip to content

Commit

Permalink
json fix
Browse files Browse the repository at this point in the history
  • Loading branch information
georgefst committed Apr 27, 2023
1 parent 12523bd commit 17c9725
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions primer/src/Primer/JSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import Data.Aeson (
ToJSON,
ToJSONKey,
)
import Deriving.Aeson (CustomJSON (..))
import Deriving.Aeson.Stock (Vanilla)
import Deriving.Aeson (CustomJSON (..), OmitNothingFields)

-- | A type for Primer API JSON encodings.
--
Expand Down Expand Up @@ -43,4 +42,10 @@ import Deriving.Aeson.Stock (Vanilla)
--
-- * @SumTwoElemArray@ is unsupported by openapi3 as it is unrepresentable in
-- a schema.
type PrimerJSON a = Vanilla a
type PrimerJSON a =
CustomJSON
'[ -- This protects some clients (e.g. TypeScript) from spurious equality failures
-- due to null-vs-omitted inconsistency.
OmitNothingFields
]
a

0 comments on commit 17c9725

Please sign in to comment.