Open johnwc opened 2 months ago
@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 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.
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.
@ElizabethOkerio I did not see where @mikepizzo made that suggestion, can you share the link to that?
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