Complete documentation
parent
dd5f298fd3
commit
acd13ac67a
|
@ -190,10 +190,9 @@ failures =
|
|||
}
|
||||
|
||||
|
||||
|
||||
-- TODO
|
||||
|
||||
|
||||
{-| Objects contain multiple fields. These fields are here described, explaining
|
||||
what they do and what they are for.
|
||||
-}
|
||||
fields :
|
||||
{ context :
|
||||
{ accessToken : Desc
|
||||
|
@ -270,11 +269,17 @@ fields =
|
|||
}
|
||||
|
||||
|
||||
{-| This message will be shown when a [Hashdict](Internal-Tools-Hashdict)
|
||||
encounters a hash-value pair where the value does not hash to the provided hash.
|
||||
-}
|
||||
invalidHashInHashdict : String
|
||||
invalidHashInHashdict =
|
||||
"Invalid hash function: not all elements hash to their JSON-stored hashes"
|
||||
|
||||
|
||||
{-| This message will be shown when a [Mashdict](Internal-Tools-Mashdict)
|
||||
encounters a hash-value pair where the value does not hash to the provided hash.
|
||||
-}
|
||||
invalidHashInMashdict : String
|
||||
invalidHashInMashdict =
|
||||
"Invalid hash function: not all elements hash to their JSON-stored hashes"
|
||||
|
|
|
@ -81,6 +81,8 @@ type Hashdict a
|
|||
}
|
||||
|
||||
|
||||
{-| Define how Hashdict can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : (a -> String) -> Json.Coder a -> Json.Coder (Hashdict a)
|
||||
coder f c1 =
|
||||
Json.andThen
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
module Internal.Tools.Json exposing
|
||||
( Coder, string, bool, int, float, value
|
||||
, Encoder, encode, Decoder, decode, Value
|
||||
, succeed, fail, andThen, lazy
|
||||
, succeed, fail, andThen, lazy, map
|
||||
, Docs(..), RequiredField(..), toDocs
|
||||
, list, slowDict, fastDict, maybe
|
||||
, Field, field
|
||||
, object2, object3, object4, object5, object6, object7, object8, object9, object10, object11
|
||||
, map
|
||||
)
|
||||
|
||||
{-|
|
||||
|
@ -40,7 +39,7 @@ module to build its encoders and decoders.
|
|||
|
||||
## Optional coding
|
||||
|
||||
@docs succeed, fail, andThen, lazy
|
||||
@docs succeed, fail, andThen, lazy, map
|
||||
|
||||
|
||||
## Documentation
|
||||
|
@ -176,6 +175,8 @@ type RequiredField
|
|||
| OptionalFieldWithDefault String
|
||||
|
||||
|
||||
{-| Represents an arbitary JavaScript value.
|
||||
-}
|
||||
type alias Value =
|
||||
E.Value
|
||||
|
||||
|
@ -424,6 +425,8 @@ int =
|
|||
}
|
||||
|
||||
|
||||
{-| Define a lazy coder. This is useful when defining recursive structures.
|
||||
-}
|
||||
lazy : (() -> Coder value) -> Coder value
|
||||
lazy f =
|
||||
Coder
|
||||
|
@ -1144,6 +1147,9 @@ toEncodeField (Field data) =
|
|||
( data.fieldName, data.toField >> data.encoder )
|
||||
|
||||
|
||||
{-| Do not do anything useful with a JSON value, just bring it to Elm as a
|
||||
JavaScript value.
|
||||
-}
|
||||
value : Coder Value
|
||||
value =
|
||||
Coder
|
||||
|
|
|
@ -93,6 +93,8 @@ type Mashdict a
|
|||
}
|
||||
|
||||
|
||||
{-| Define how a Mashdict can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : (a -> Maybe String) -> Json.Coder a -> Json.Coder (Mashdict a)
|
||||
coder f c1 =
|
||||
Json.andThen
|
||||
|
|
|
@ -95,6 +95,8 @@ apiFormat context =
|
|||
}
|
||||
|
||||
|
||||
{-| Define how a Context can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : Json.Coder Context
|
||||
coder =
|
||||
Json.object7
|
||||
|
|
|
@ -4,7 +4,7 @@ module Internal.Values.Envelope exposing
|
|||
, Settings, mapSettings, extractSettings
|
||||
, mapContext
|
||||
, getContent, extract
|
||||
, encode, decoder
|
||||
, coder, encode, decoder
|
||||
)
|
||||
|
||||
{-| The Envelope module wraps existing data types with lots of values and
|
||||
|
@ -68,6 +68,8 @@ type alias Settings =
|
|||
Settings.Settings
|
||||
|
||||
|
||||
{-| Define how an Envelope can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : Json.Coder a -> Json.Coder (Envelope a)
|
||||
coder c1 =
|
||||
Json.object3
|
||||
|
|
|
@ -64,6 +64,8 @@ age event =
|
|||
Maybe.andThen (\(UnsignedData data) -> data.age) event.unsigned
|
||||
|
||||
|
||||
{-| Define how an Event can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : Json.Coder Event
|
||||
coder =
|
||||
Json.object8
|
||||
|
|
|
@ -39,6 +39,8 @@ type alias Settings =
|
|||
}
|
||||
|
||||
|
||||
{-| Define how a Settings type can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : Json.Coder Settings
|
||||
coder =
|
||||
Json.object3
|
||||
|
|
|
@ -93,6 +93,8 @@ cleanKey key (StateManager manager) =
|
|||
|> StateManager
|
||||
|
||||
|
||||
{-| Define how a StateManager can be encoded to and decoded from a JSON object.
|
||||
-}
|
||||
coder : Json.Coder StateManager
|
||||
coder =
|
||||
Event.coder
|
||||
|
|
Loading…
Reference in New Issue