decoder : List ( StructuredText.ItemId, a ) -> Json.Decode.Decoder (StructuredText a)
Decodes a DatoCMS DAST schema.
It requires a list of items that are used within blocks, inline items and/or item links nodes. If you don't use any of those nodes in your DAST document, you can provide an empty list.
type alias ImageItem =
{ url : String
, alt : String
}
items : List ( ItemId, ImageItem )
items =
[ ( itemId "123456789", { url = "https://www.datocms-assets.com/some/path.png", alt = "Some image" } ) ]
myFieldDecoder : Decoder (StructuredText ImageItem)
myFieldDecoder =
Decode.field "value" (StructuredText.Decode.decoder items)