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

Metadata Validation Fidelity #675

Open
cfranchuk opened this issue Oct 3, 2019 · 1 comment
Open

Metadata Validation Fidelity #675

cfranchuk opened this issue Oct 3, 2019 · 1 comment

Comments

@cfranchuk
Copy link

Currently the Simple.Odata.Client library provides a Boolean property IgnoreUnmappedProperties to alter the behavior of validations that occur in the underlying Microsoft.OData library class ODataMessageReaderSettings. However, that class has many more options that could be set. In my current use case we have a class that contains an ID property set by the service on Insert. In the metadata, that property is marked as required causing the Simple.OData.Client to throw an error before sending an Insert request. I do realize that we can use the overloads of the Set method that allows us to specify the properties to send. Their are workarounds. But overall, I feel that Metadata validations have gotten in the way of things we wish to do more than prevent us from making mistakes. Please feel free to disagree with me, but I am assuming Microsoft made these options available for a reason in their library.

//
// Summary:
// Validation kinds used in ODataMessageReaderSettings and ODataMessageWriterSettings.
[Flags]
public enum ValidationKinds
{
All = -1,
None = 0,
ThrowOnDuplicatePropertyNames = 1,
ThrowOnUndeclaredPropertyForNonOpenType = 2,
ThrowIfTypeConflictsWithMetadata = 4
}

@ExpDev07
Copy link

ExpDev07 commented Nov 26, 2024

In my current use case we have a class that contains an ID property set by the service on Insert. In the metadata, that property is marked as required causing the Simple.OData.Client to throw an error before sending an Insert request

I'm having the same issue. What does the workaround look like? Setting validations to none does not seem to work, it throws:

An error occured when creating batch with reason The given key 'type' was not present in the dictionary.

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

No branches or pull requests

2 participants