You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For atdpy or other code generators, we would like to add the option to skip malformed elements and report them as errors, as it's done by tree-sitter parsers and ocaml-tree-sitter.
Partial parsing is based on removing malformed elements from list and option containers. This results in a well-formed result and a list of malformed JSON nodes rather than failing completely.
Applications
The goal is for a JSON consumer - typically a client reading a response from a server - to make the best of what the server produces. This happens when the server response is a list of items of which some declare a new kind:
type flavor = [
| Vanilla
| Chocolate
| Mango
| Pear (* new! *)
]
type available_flavors = flavor list
The following JSON data is of type available_flavors:
[ "Vanilla", "Pear", "Chocolate" ]
An older client that doesn't know about the latest Pear flavor can't read this list correctly but it can ignore the unknown flavor. The generated from_json function would read the JSON input as if it were
[ "Vanilla", "Chocolate" ]
and would report the node "Pear" as an error where the type available_flavors (older version) was expected.
The text was updated successfully, but these errors were encountered:
For atdpy or other code generators, we would like to add the option to skip malformed elements and report them as errors, as it's done by tree-sitter parsers and ocaml-tree-sitter.
Partial parsing is based on removing malformed elements from
list
andoption
containers. This results in a well-formed result and a list of malformed JSON nodes rather than failing completely.Applications
The goal is for a JSON consumer - typically a client reading a response from a server - to make the best of what the server produces. This happens when the server response is a list of items of which some declare a new kind:
The following JSON data is of type
available_flavors
:An older client that doesn't know about the latest
Pear
flavor can't read this list correctly but it can ignore the unknown flavor. The generatedfrom_json
function would read the JSON input as if it wereand would report the node
"Pear"
as an error where the typeavailable_flavors
(older version) was expected.The text was updated successfully, but these errors were encountered: