aeson / Data / Aeson / Types / Internal.hs

The default branch has multiple heads

Diff from to

Data/Aeson/Types/Internal.hs

 
 -- | Specifies how to encode constructors of a sum datatype.
 data SumEncoding =
-    ObjectWithType { typeFieldName  :: String
-                   , valueFieldName :: String
+    ObjectWithType { typeFieldName     :: String
+                   , contentsFieldName :: String
                    }
     -- ^ A constructor will be encoded to an object with a field
     -- 'typeFieldName' which specifies the constructor name (modified
     -- record the encoded record fields will be unpacked into this
     -- object. So make sure that your record doesn't have a field with
     -- the same name as the 'typeFieldName'. Otherwise the type gets
-    -- overwritten by that field. If the constructor is not a record
-    -- the encoded constructor content will be stored under the
-    -- 'valueFieldName' field.
+    -- overwritten by that field! If the constructor is not a record
+    -- the encoded constructor contents will be stored under the
+    -- 'contentsFieldName' field.
   | ObjectWithSingleField
     -- ^ A constructor will be encoded to an object with a single
     -- field named after the constructor (modified by the
     -- ^ A constructor will be encoded to a 2-element array where the
     -- first element is the name of the constructor (modified by the
     -- 'constructorNameModifier') and the second element the encoded
-    -- content of the constructor.
+    -- contents of the constructor.
 
 -- | Default encoding 'Options':
 --
 --
 -- @
 -- defaultObjectWithType = 'ObjectWithType'
---                         { 'typeFieldName'  = \"type\"
---                         , 'valueFieldName' = \"value\"
+--                         { 'typeFieldName'     = \"type\"
+--                         , 'contentsFieldName' = \"contents\"
 --                         }
 -- @
 defaultObjectWithType :: SumEncoding
 defaultObjectWithType = ObjectWithType
-                        { typeFieldName  = "type"
-                        , valueFieldName = "value"
+                        { typeFieldName     = "type"
+                        , contentsFieldName = "contents"
                         }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.