Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
(Java) V4 4.7.1
-
None
-
Linux, OSX, Windows.
Description
Using the Olingo XML Metadata validation methods, they correctly catch the case where there is no Key property defined in the metadata for a given EntityType definition.
For example, this will produce an error:
<?xml version="1.0" encoding="utf-8"?> <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> <edmx:DataServices> <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="org.example"> <EntityType Name="SomeEntityType"> <Property Name="SomeEntityTypeKey" Type="edm.String" Nullable="false" /> </EntityType> </Schema> <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Default"> <EntityContainer Name="Container"> <EntitySet Name="SomeEntityType" EntityType="org.example.SomeEntityType"/> </EntityContainer> </Schema> </edmx:DataServices> </edmx:Edmx>
However, the Key can be defined without the EntityType's Property definition for that field being present, and this is something that the metadata validation does not catch.
<?xml version="1.0" encoding="utf-8"?> <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> <edmx:DataServices> <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="org.example"> <EntityType Name="SomeEntityType"> <Key> <PropertyRef Name="SomeEntityTypeKey"/> </Key> </EntityType> </Schema> <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Default"> <EntityContainer Name="Container"> <EntitySet Name="SomeEntityType" EntityType="org.example.SomeEntityType"/> </EntityContainer> </Schema> </edmx:DataServices> </edmx:Edmx>
This ticket was created to request that XML metadata validation check both whether a Key is present, and that the defined key also has a corresponding Property definition in the metadata. Otherwise, metadata validation should fail.