Azure / Azure/azure-functions-host
Consider adopting RFC7807 (JSON Problem Object) for errors
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Although functions should do most of their own error handling and return serialization, there are a few areas where Azure handles or returns errors before client functions are even woken up or called. (Current most vexing case: JSON deserialization, especially if it doesn't pass validation)
For those times, consider adopting/returning [RFC7807](https://tools.ietf.org/html/rfc7807) (JSON Problem Object), or one of the other potentially relevant standards (such as [JSON RPC](http://www.jsonrpc.org/specification)).
This behavior may have to be opt-in (or opt-in to force), although automatic detection is likely possible:
- The current standard for JSON RPC requires a top-level `"jsonrpc": "2.0"` field.
- XML RPC has a `` root element.
- XML vs JSON is reasonably easy to detect.
Doing this would make client callers able to act as if the messages Azure generates come from the hosted function itself. This is likely to be particularly important if the function host is going to insist on being strongly typed and do deserialization on my behalf; I'd really like a 400 telling me, _specifically_, that my JSON object is invalid, or is missing this or that required field, or whatever.
Contributor guide
Research direction
No files, tests, or entry points are named. Start by tracing the host paths that handle JSON deserialization and validation before invoking client functions, then compare RFC7807 with JSON-RPC and determine how opt-in or detection should work. Done means a decided standard and a defined 400-error contract for invalid or missing fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100