Query/Json: inconsistent behavior around missing required navigations in JSON entities
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
When we have a JSON entity which owns another via required navigation, we have inconsistent behavior, when that navigation is missing in the actual JSON.
If we project the owner entity, missing required navigation is materialized as null with no errors. This is because of how we process the JSON on relational - we parse the stream, so we only fill properties/navigations that we encounter data for. If there is no data for required navigation, its materialization code is not triggered and we end up with the default value (null).
However, if the required navigation is projected directly (rather than as part of an owner), we do run some validation when attempting to materialize it and throw:
`System.InvalidOperationException : Entity JsonEntityNested is required but the JSON element containing it is null.`
Contributor guide
Assessment
This issue has not been assessed yet.