@@ -110,7 +110,7 @@ nonAllNullarySumToJSON :: ( TwoElemArray f
110nonAllNullarySumToJSON opts =
110nonAllNullarySumToJSON opts =
111 case sumEncoding opts of
111 case sumEncoding opts of
112 ObjectWithType{..} -> object . objectWithType opts typeFieldName
112 ObjectWithType{..} -> object . objectWithType opts typeFieldName
113− valueFieldName
113+ contentsFieldName
114 ObjectWithSingleField -> Object . objectWithSingleField opts
114 ObjectWithSingleField -> Object . objectWithSingleField opts
115 TwoElemArray -> Array . twoElemArray opts
115 TwoElemArray -> Array . twoElemArray opts
116{-# INLINE nonAllNullarySumToJSON #-}
116{-# INLINE nonAllNullarySumToJSON #-}
@@ -122,20 +122,20 @@ class ObjectWithType f where
123instance ( ObjectWithType a
123instance ( ObjectWithType a
124 , ObjectWithType b ) => ObjectWithType (a :+: b) where
124 , ObjectWithType b ) => ObjectWithType (a :+: b) where
125− objectWithType opts typeFieldName valueFieldName (L1 x) =
125+ objectWithType opts typeFieldName contentsFieldName (L1 x) =
126− objectWithType opts typeFieldName valueFieldName x
126+ objectWithType opts typeFieldName contentsFieldName x
127− objectWithType opts typeFieldName valueFieldName (R1 x) =
127+ objectWithType opts typeFieldName contentsFieldName (R1 x) =
128− objectWithType opts typeFieldName valueFieldName x
128+ objectWithType opts typeFieldName contentsFieldName x
129 {-# INLINE objectWithType #-}
129 {-# INLINE objectWithType #-}
131instance ( IsRecord a isRecord
131instance ( IsRecord a isRecord
132 , ObjectWithType' a isRecord
132 , ObjectWithType' a isRecord
133 , Constructor c ) => ObjectWithType (C1 c a) where
133 , Constructor c ) => ObjectWithType (C1 c a) where
134− objectWithType opts typeFieldName valueFieldName =
134+ objectWithType opts typeFieldName contentsFieldName =
135 (pack typeFieldName .= constructorNameModifier opts
135 (pack typeFieldName .= constructorNameModifier opts
136 (conName (undefined :: t c a p)) :) .
136 (conName (undefined :: t c a p)) :) .
137 (unTagged :: Tagged isRecord [Pair] -> [Pair]) .
137 (unTagged :: Tagged isRecord [Pair] -> [Pair]) .
138− objectWithType' opts valueFieldName . unM1
138+ objectWithType' opts contentsFieldName . unM1
139 {-# INLINE objectWithType #-}
139 {-# INLINE objectWithType #-}
141class ObjectWithType' f isRecord where
141class ObjectWithType' f isRecord where
@@ -146,8 +146,8 @@ instance (RecordToPairs f) => ObjectWithType' f True where
146 {-# INLINE objectWithType' #-}
146 {-# INLINE objectWithType' #-}
148instance (GToJSON f) => ObjectWithType' f False where
148instance (GToJSON f) => ObjectWithType' f False where
149− objectWithType' opts valueFieldName =
149+ objectWithType' opts contentsFieldName =
150− Tagged . (:[]) . (pack valueFieldName .=) . gToJSON opts
150+ Tagged . (:[]) . (pack contentsFieldName .=) . gToJSON opts
151 {-# INLINE objectWithType' #-}
151 {-# INLINE objectWithType' #-}
153--------------------------------------------------------------------------------
153--------------------------------------------------------------------------------
@@ -387,7 +387,7 @@ parseNonAllNullarySum opts =
387 withObject "Object" $ \obj -> do
387 withObject "Object" $ \obj -> do
388 key <- obj .: pack typeFieldName
388 key <- obj .: pack typeFieldName
389 fromMaybe (notFound $ unpack key) $
389 fromMaybe (notFound $ unpack key) $
390− parseFromObjectWithType opts valueFieldName obj key
390+ parseFromObjectWithType opts contentsFieldName obj key
392 ObjectWithSingleField ->
392 ObjectWithSingleField ->
393 withObject "Object" $ \obj ->
393 withObject "Object" $ \obj ->
@@ -414,16 +414,16 @@ class FromObjectWithType f where
415instance (FromObjectWithType a, FromObjectWithType b) =>
415instance (FromObjectWithType a, FromObjectWithType b) =>
416 FromObjectWithType (a :+: b) where
416 FromObjectWithType (a :+: b) where
417− parseFromObjectWithType opts valueFieldName obj key =
417+ parseFromObjectWithType opts contentsFieldName obj key =
418− (fmap L1 <$> parseFromObjectWithType opts valueFieldName obj key) <|>
418+ (fmap L1 <$> parseFromObjectWithType opts contentsFieldName obj key) <|>
419− (fmap R1 <$> parseFromObjectWithType opts valueFieldName obj key)
419+ (fmap R1 <$> parseFromObjectWithType opts contentsFieldName obj key)
420 {-# INLINE parseFromObjectWithType #-}
420 {-# INLINE parseFromObjectWithType #-}
422instance ( FromObjectWithType' f
422instance ( FromObjectWithType' f
423 , Constructor c ) => FromObjectWithType (C1 c f) where
423 , Constructor c ) => FromObjectWithType (C1 c f) where
424− parseFromObjectWithType opts valueFieldName obj key
424+ parseFromObjectWithType opts contentsFieldName obj key
425 | key == name = Just $ M1 <$> parseFromObjectWithType'
425 | key == name = Just $ M1 <$> parseFromObjectWithType'
426− opts valueFieldName obj
426+ opts contentsFieldName obj
427 | otherwise = Nothing
427 | otherwise = Nothing
429 name = pack $ constructorNameModifier opts $
429 name = pack $ constructorNameModifier opts $
@@ -442,9 +442,9 @@ class FromObjectWithType'' f isRecord where
442instance ( IsRecord f isRecord
442instance ( IsRecord f isRecord
443 , FromObjectWithType'' f isRecord
443 , FromObjectWithType'' f isRecord
444 ) => FromObjectWithType' f where
444 ) => FromObjectWithType' f where
445− parseFromObjectWithType' opts valueFieldName =
445+ parseFromObjectWithType' opts contentsFieldName =
446 (unTagged :: Tagged isRecord (Parser (f a)) -> Parser (f a)) .
446 (unTagged :: Tagged isRecord (Parser (f a)) -> Parser (f a)) .
447− parseFromObjectWithType'' opts valueFieldName
447+ parseFromObjectWithType'' opts contentsFieldName
448 {-# INLINE parseFromObjectWithType' #-}
448 {-# INLINE parseFromObjectWithType' #-}
450instance (FromRecord f) => FromObjectWithType'' f True where
450instance (FromRecord f) => FromObjectWithType'' f True where
@@ -452,8 +452,8 @@ instance (FromRecord f) => FromObjectWithType'' f True where
452 {-# INLINE parseFromObjectWithType'' #-}
452 {-# INLINE parseFromObjectWithType'' #-}
454instance (GFromJSON f) => FromObjectWithType'' f False where
454instance (GFromJSON f) => FromObjectWithType'' f False where
455− parseFromObjectWithType'' opts valueFieldName = Tagged .
455+ parseFromObjectWithType'' opts contentsFieldName = Tagged .
456− (gParseJSON opts <=< (.: pack valueFieldName))
456+ (gParseJSON opts <=< (.: pack contentsFieldName))
457 {-# INLINE parseFromObjectWithType'' #-}
457 {-# INLINE parseFromObjectWithType'' #-}
459--------------------------------------------------------------------------------
459--------------------------------------------------------------------------------