Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to #30028 - Added nullable property to Json mapped model resulting in errors instead of mapping non existing json property to null #30101

Merged
merged 1 commit into from
Feb 24, 2023

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Jan 20, 2023

Problem was that we when accessing inner property on a JsonElement we used GetProperty. If property is not present (which should be allowed if we try to access optional navigation) KeyNotFound is thrown.

Fix is to use TryGetProperty instead to gracefully handle this scenario.

Fixes #30028

@maumar maumar requested review from roji and a team January 20, 2023 02:49
@maumar maumar changed the title Fix to #30062 - KeyNotFoundException on nullable nested object in JSON column if that object does not exist. Fix to #30028 - Added nullable property to Json mapped model resulting in errors instead of mapping non existing json property to null Jan 20, 2023
@ajcvickers
Copy link
Member

@roji Can you take a look at this? We're considering it for a patch.

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some possible simplifications but otherwise LGTM

…g in errors instead of mapping non existing json property to null

Problem was that we when accessing inner property on a JsonElement we used GetProperty. If property is not present (which should be allowed if we try to access optional navigation) KeyNotFound is thrown.

Fix is to use TryGetProperty instead to gracefully handle this scenario.

Fixes #30028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants