-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
Update JsonObjectTypeExtensions.cs #5649
Conversation
Root cause: When GetDateTimeOffset() is performed on null, we will get an error stating "The requested operation requires an element of type 'String', but the target element has type 'Null' ". This will happen when the value of DateTime field is null. Code fix: The proposed change will ensure that the system returns null when DateTime field is null instead of throwing an error.
Can you provide a minimal test showing the issue you are referring to? I have the feeling that this does not really fix the the issue or rather applies some logic that overlays an issue here. |
@vickytr44 do you want to advance this PR? |
Yes, I would like to move forward with the pull request. Let me also create a sample project where we can reproduce this issue. |
I have created a sample project to reproduce the issue. I've included the link for the project. Here Book type will get its Author details from a rest service and for one of the author the birthdate is null . When you try to query the author's details the query will throw an error. Query: Result: |
Root cause: When GetDateTimeOffset() is performed on null, we will get an error stating "The requested operation requires an element of type 'String', but the target element has type 'Null' ". This will happen when the value of DateTime field is null.
Code fix: The proposed change will ensure that the system returns null when DateTime field is null instead of throwing an error.