Skip to content

Commit

Permalink
bypass decode error
Browse files Browse the repository at this point in the history
  • Loading branch information
lostbean committed Nov 30, 2024
1 parent c6a71d9 commit ad7ac00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "json_blueprint"
version = "1.2.1"
version = "1.2.2"

description = "Simplify JSON encoding/decoding while automatically generating JSON schemas for your data types."
licences = ["MIT"]
Expand Down
9 changes: 5 additions & 4 deletions src/json/blueprint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ pub fn union_type_decoder(
) {
decoders
|> list.find_map(fn(dec) {
case dec {
#(name, d) if type_str == name -> {
let #(dyn_decoder, _) = d
dyn_decoder(data)
case dec.0 == type_str {
True -> {
let #(dyn_decoder, _) = dec.1
Ok(dyn_decoder(data))
}
_ -> Error([])
}
Expand All @@ -157,6 +157,7 @@ pub fn union_type_decoder(
),
]
})
|> result.flatten
}

let enum_decoder = fn(data) {
Expand Down

0 comments on commit ad7ac00

Please sign in to comment.