OData does not place any restriction on name unicity for properties within the entire model.
When working with large models, property names are often not unique (entirely distinct types may have properties with the same name).
The ODataWriter emits exception messages which only include the problematic property name, but not the declaring type.
In large payloads with multiple nested scopes, it can be difficult for customers to find the problematic property value.
Suggestion: include the declaring type's full name in the exception message.
Assemblies affected
All Microsoft.OData.Core up to 7.21 included.
Reproduce steps
Using:
A model with a non-nullable property
Writer validation enabled
Provide the ODataWriter with a null value for that property.
Expected result
Error message including the declaring type name, such as:
The property 'bar[Nullable=False]' of type 'Edm.String' declared by type 'microsoft.foo' has a null value, which is not allowed.
Actual result
Error message:
The property 'bar[Nullable=False]' of type 'Edm.String' has a null value, which is not allowed.
OData does not place any restriction on name unicity for properties within the entire model. When working with large models, property names are often not unique (entirely distinct types may have properties with the same name).
The ODataWriter emits exception messages which only include the problematic property name, but not the declaring type. In large payloads with multiple nested scopes, it can be difficult for customers to find the problematic property value.
Suggestion: include the declaring type's full name in the exception message.
Assemblies affected
All
Microsoft.OData.Core
up to 7.21 included.Reproduce steps
Using:
Provide the ODataWriter with a
null
value for that property.Expected result
Error message including the declaring type name, such as:
The property 'bar[Nullable=False]' of type 'Edm.String' declared by type 'microsoft.foo' has a null value, which is not allowed.
Actual result
Error message:
The property 'bar[Nullable=False]' of type 'Edm.String' has a null value, which is not allowed.