SAP / open-ux-odata

Enable community collaboration to jointly promote and facilitate best in class framework and tooling capabilities when working with OData services.
Apache License 2.0
51 stars 12 forks source link

Wrong __metadata id/uri when using a combined key with string and int32 #641

Closed sb-aigh closed 1 year ago

sb-aigh commented 1 year ago

Description

Assuming one has defined a V2 entity with a combined key containing string and int32, like....

    <EntityType Name="MyEntity">
        <Key>
            <PropertyRef Name="ObjectId"/>
            <PropertyRef Name="Id"/>
            <PropertyRef Name="Version"/>
        </Key>
        <Property Name="ObjectId" Type="Edm.String" Nullable="false" MaxLength="255"/>
        <Property Name="Id" Type="Edm.Int32" Nullable="false"/>
        <Property Name="Version" Type="Edm.String" Nullable="false" MaxLength="18"/>
        <Property Name="Type" Type="Edm.String" Nullable="false" MaxLength="40"/>
        <Property Name="Sequence" Type="Edm.Int32" Nullable="true"/>
        <NavigationProperty Name="MySubEntity" Relationship="MyEntityToMySubEntity" FromRole="FromRole_MyEntityToMySubEntity" ToRole="ToRole_MyEntityToMySubEntity"/>
    </EntityType>

As far as I could see, the function addV2Metadata in dataAccess.ts converts all keys to strings with single quotes. In the app, when accessing the UI context with path /MyEntities(ObjectId='3cd0813b921744539da05c34d72ec7fa',Id=4,Version='000002'), no data is returned as the mockserver created the mockdata with key /MyEntities(ObjectId='3cd0813b921744539da05c34d72ec7fa',Id='4',Version='000002') (Id=4 versus Id='4').

Expected results

The metadata id/uri should have the correct path with Id having an integer value. Maybe there is a hook to influence the mockdata creation and/or to adjust the metadata values?

nlunets commented 1 year ago

Fixed with @sap-ux/ui5-middleware-fe-mockserver@2.1.109