OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-1450) Key with PropertyRef using navigation path incompatible with Protocol 11.4.2 "Create an Entity"


Evan Ireland created ODATA-1450:
-----------------------------------

             Summary: Key with PropertyRef using navigation path incompatible with Protocol 11.4.2 "Create an Entity"
                 Key: ODATA-1450
                 URL: https://issues.oasis-open.org/browse/ODATA-1450
             Project: OASIS Open Data Protocol (OData) TC
          Issue Type: Bug
          Components: CSDL XML
    Affects Versions: V4.01_OS
            Reporter: Evan Ireland


Consider this CSDL.

{code:xml}
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://docs.oasis-open.org/odata/ns/edmx http://docs.oasis-open.org/odata/odata/v4.0/os/schemas/edmx.xsd http://docs.oasis-open.org/odata/ns/edm http://docs.oasis-open.org/odata/odata/v4.0/os/schemas/edm.xsd";>
    <edmx:DataServices>
        <Schema Namespace="example" xmlns="http://docs.oasis-open.org/odata/ns/edm"; Alias="Self">
            <EntityType Name="Customer">
                <Key>
                    <PropertyRef Name="ID"/>
                </Key>
                <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
                <NavigationProperty Name="Photo" Type="Self.CustomerPhoto" Partner="Customer">
                    <OnDelete Action="Cascade"/>
                </NavigationProperty>
            </EntityType>
            <EntityType Name="CustomerPhoto">
                <Key>
                    <PropertyRef Name="Customer/ID" Alias="CustomerID"/>
                </Key>
                <Property Name="Photo" Type="Edm.Stream" Nullable="false"/>
                <NavigationProperty Name="Customer" Type="Self.Customer" Nullable="false"/>
            </EntityType>
            <EntityContainer Name="CustomerService">
                <EntitySet Name="Customers" EntityType="Self.Customer">
                    <NavigationPropertyBinding Path="Photo" Target="CustomerPhotos"/>
                </EntitySet>
                <EntitySet Name="CustomerPhotos" EntityType="Self.CustomerPhoto">
                    <NavigationPropertyBinding Path="Customer" Target="Customers"/>
                </EntitySet>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>
{code}

If a client sends this request:

    POST /CustomerPhotos
    {"Customer":{"ID":123}}

then per Protocol 11.4.2 "Create an Entity":

*The entity representation MAY include references to existing entities as well as content for new related entities, but MUST NOT contain content for existing related entities.*

... the above POST request MUST be interpreted as a deep insert. The client cannot portably create a CustomerPhoto as any attempt to specify its key (via the customer it relates to) will be interpreted as a deep insert.

If we were to relax the language in section 11.4.2 to allow an interpretation of relating a CustomerPhoto to an existing Customer (rather than also creating the Customer by deep insert), then the specification is now ambiguous in regard to the correct interpretation of the above example payload.

Similar issues apply to 11.4.3.1 "Update Related Entities When Updating an Entity"

*If a nested entity has the same id or key fields as an existing entity, the existing entity is updated according to the semantics of the PUT or PATCH request.*

Using the same payload for updating an existing CustomerPhoto by PUT (in an attempt to link the photo to a different Customer) would be interpreted as a deep update to PUT the newly related customer (clearing its non-key properties).




--
This message was sent by Atlassian Jira
(v8.3.3#803004)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]