-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve JSON encoding of sig, auth & query errors
The naïve encoding of `Result` in JSON is an object with either a `Ok` or a `Err` field, containing the JSON encoding of either the value or the error. This is a rather uncommon JSON encoding for errors and ties the output to the implementation language. This commit introduces an equivalent enum, with a different encoding: - in case of success, the value is serialized without any wrapping - in case of error, the error is wrapped in an object with a single `error` field ```json { "query": "user($u) <- user($u)", "query_all": false, "facts": [ "user(\"1234\")"] } ``` ```json { "query": "user($u) <- user($u)", "query_all": false, "facts": { "error": … } } ```
- Loading branch information
Showing
1 changed file
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters