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

Allow ignoring errors, like collection is null from server response #3012

Open
johnwc opened this issue Jul 3, 2024 · 4 comments
Open

Allow ignoring errors, like collection is null from server response #3012

johnwc opened this issue Jul 3, 2024 · 4 comments
Assignees

Comments

@johnwc
Copy link

johnwc commented Jul 3, 2024

There is quite a few oData services out in the wild that we are unable to connect to with these client libraries because they return the value null for properties marked as being a collection. Apparently even Microsoft's own software does this. In all realty, most developers could care less if a collection was returned as being null in the response. If the server does not respond with the property in the response at all, the collection is still null but no error is thrown.

We need to be able to tell the client to ignore this specific issue and not to throw an error when parsing the oData response.
It stems from this method.
https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Core/ReaderValidationUtils.cs#L1171

@ElizabethOkerio
Copy link
Contributor

ElizabethOkerio commented Jul 4, 2024

@johnwc Look at this doc on how to omit null values from both the server side and client side: https://devblogs.microsoft.com/odata/extension-omit-null-value-properties-in-asp-net-core-odata/. Let me know if this helps.

@johnwc
Copy link
Author

johnwc commented Jul 5, 2024

@johnwc Look at this doc on how to omit null values from both the server side and client side: https://devblogs.microsoft.com/odata/extension-omit-null-value-properties-in-asp-net-core-odata/. Let me know if this helps.

That does not do anything for client side to ignore anything, that example shows how to send a custom header to a custom server to tell the server to not return null values.

@ElizabethOkerio
Copy link
Contributor

ElizabethOkerio commented Jul 10, 2024

As per the OData spec collections should not be null but can be empty that's why we validate this. But as @mikepizzo suggested to improve user experience, we can have an opt-in flag that ignores some of these validations.

@johnwc
Copy link
Author

johnwc commented Jul 15, 2024

@ElizabethOkerio I did not see where @mikepizzo made that suggestion, can you share the link to that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants