Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Enable updating top-level properties to null #645
referenced this issue
Feb 21, 2018
The scenario is not supported per the language of the spec:
11.2.3 Requesting Individual Properties
So the right thing to do is return 204.
However, I've made a change to the library to enable back-compat behavior via a writer validation that is on by default. When turned off, the exception is no longer throws an "value":null is written. Not that thus behavior is not compliant with the latest protocol. See #1093 for the change.
@robward-ms Thanks for making the fix. I understand that this is not in the spec but in order to not break our existing clients integration we still need to support that on our end.
I've reviewed the PR and the changes that you've made. However it's not really apparent to me how can I change the behaviour in my application.
Where from my WebApiConfig can I set the ODataLibraryCompatibility to version 6.xxxx?
I went through the documentation that you provided me. I was able to build my own container and add a modified ODataMessageWriterSettings that sets the LibraryCompatibility to Version6.
However I haven't figured out how to pass it to ODataLib. It's specified that it can be sent through ODataMessageReader/ODataMessageWriter or ODataUriParser but there's no example provided and I couldn't find more information.
I was able to change the setting by manually doing the following code in one of my action
However I have the problem at large and doing so would be very inefficient. Could you provide me the information I seem to be missing or point me in a direction for the answer? Please note I use OData6.0.0 at the moment as one of my package has a reference to it and prevent me from targeting 7.0.0 at the moment. OData.Core is 126.96.36.19921.
On WebApi 6.x, client can customize the service container using a customized configureAction for MapODataServiceRoute method.
In configureAction, you can specify build => builder.AddServicePrototype(new ODataMessageWriterSettings