Changelog
1.1.0 (Mar 25, 2023)
This release adds helpers to ease the transition away from the deprecated features in the 1.0 release. Barring any bugs that require fixing, this is the last planned release in the 1.x series.
hush
is a new function that takes a Decode.AsResult.OfParseError
decoder and converts it into a Js.Json.t => option('a)
decoder (effectively "hushing" the error). This should make the transition away from Decode.AsOption
easier.literalBool
, literalTrue
, and literalFalse
join the other literal*
decoders that first decode, then further validate the outputintUnion
works like stringUnion
and should make the transition away from variantFromInt
easierChangelog
1.0.0 (Mar 9, 2023)
Version 1.0 is here! Very little has changed since 0.11.2; mostly this release indicates the stability (or lack of maintenance, depending on how you look at it) over the last several years. The 1.x releases will be the last to support BuckleScript as we turn our attention to Melange.
There are no breaking changes in this release, but there are a handful of deprecations. We should end up with decent alternatives to all of the features that will eventually be removed, but if any of this concerns you, please let me know!
Decode.AsResult.OfStringNel
will be removed in an upcoming release. The errors are less useful than OfParseError
, and there's a cost to maintaining multiple decoder typesDecode.AsOption
will also be removed. Again, there's a maintenance burden in keeping it, and if you really want option
, it's easy enough to convert the result
return into an option
.Decode.Make
(for making your own custom output types) will eventually be removed as we focus on ParseError
variantFromJson
and variantFromString
will be removed in favor of new, simpler, more consistent tools for decoding variants (see the new literal
functions below)Decode.Pipeline
module is now deprecated. See the docs for alternatives and a teaser about upcoming changes that will make this experience way betterstringMap
will be removed as we try to limit how much we depend on Belt-specific features. You can use the dict
decoder instead and convert the Js.Dict
to a Belt.String.Map
.literalString
, literalInt
, and literalFloat
. These functions first decode to the expected type, then ensure the value exactly matches the provided value. This is useful for decoding unions of string literals (e.g. "dev" | "prod"
)stringUnion
function to make it even simplerbs-bastet
was bumped to 2.0
and relude
was bumped to 0.66.1
. As peer dependencies, this change is the most likely to impact your existing projects, but hopefully the update isn't too badChangelog
0.11.2 (Jun 28, 2020)
/./
in the middle of the path, which causes issues with some bundlers/dev setups (thanks @hamza0867 for finding and fixing this!)Changelog
0.11.1 (Mar 31, 2020)
public
flag in the bsconfig.json
. There are apparently some strange quirks that cause aliased modules not to compile in downstream projects, so I got rid of it. You still shouldn't need to access Decode_*
modules directly (instead use Decode.AsWhatever
) but those modules won't be hidden from you.Changelog
0.11.0 (Mar 31, 2020)
bs-abstract
peer-dependency is now bs-bastet
, and the required Relude version is 0.59+. See the Relude release notes and the Bastet migration guide for details.Decode
and prevent direct access to the Decode_*
modules via Bucklescript's public
flagokJson
is a decoder that always passes and preserves the input JSONChangelog
0.10.0 (Mar 3, 2020)
Decode.ParseError
. Specifically, this means that DecodeBase.failure
is now Decode.ParseError.base
, which is important if you're extending the base errors to create your own custom errors.Changelog
0.9.0 (Oct 7, 2019)
pipe
function itself is now publicChangelog
0.8.1 (Jul 12, 2019)
optionField
values that are present but fail to decode will now report the field in the ParseError
Changelog
0.8.0 (Jul 3, 2019)
int
and float
functions have been removed. You should be using intFromNumber
and floatFromNumber
instead to avoid shadowing issuestuple
(which previously contructed a tuple
from a JSON object) is now tupleFromFields
failure
type now includes an ExpectedTuple(int)
constructor, where int
is the expected size. This is only a breaking change if you're manually matching on values of the base failure
type.tuple2
...tuple5
(which will fail if the JSON array is larger than expected) or tupleAtLeast2
...tupleAtLeast5
(which will tolerate longer arrays)