Open fmaeseele opened 3 months ago
The error involving the top-level annotation appears to be a bug. I got a similar error trying to parse one of the sample schemas in the CSDL JSON spec.
The other error related to the Flows0.$Kind
entity set does not appear to be a bug, but rather an error in your schema. Here's the correct way to represent an entity set
"Flow0": {
- "$Kind": "EntitySet",
+ "$Collection": true,
"$Type": "Flows.Flow0"
}
Cannot get top level annotation from IEdmModel using ODataMessageReader.ReadMetadataDocument method.
Assemblies affected
Microsoft.OData.Core lib 7.x, 8.x Microsoft.OData.Edm lib 7.x, 8.x
Reproduce steps
Consider this OData metadata content:
I Cannot get the @sap.isPartial annotation from IEdmModel obtained by using the following code:
If I set the IgnoreUnexpectedJsonElements property to false, I get the following exception:
Microsoft.OData.ODataException: The metadata document could not be read from the message content. UnexpectedElement : A member '$.Flows.Flows.Flows0.$Kind' with value type 'String' is unexpected. : $.Flows.Flows.Flows0.$Kind UnexpectedElement : A member '$.Flows.@sap.isPartial' with value type 'False' is unexpected. : $.Flows.@sap.isPartial
Expected result
These annotations shouldn't be considered as invalid elements, but stored as annotations so we can retrieve them in the IEdmModel.
Actual result
These annotations are not found in the IEdmModel but instead generate errors in the model.