-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: V4.0_CSD01
-
Fix Version/s: V4.0_CSD02
-
Component/s: ABNF, Protocol, URL Conventions
-
Labels:None
-
Environment:
[Applied]
-
Proposal:
-
Resolution:
Today the syntax for deleting a link from Products(5) to the orderdetail whose id is 1 is as follows:
DELETE ~Products(5)/OrderedIn(1)/$ref
We did this as a shortcut to repeating the collection and id following the $ref.
There are two problems with this syntax. First, it is semantically a bit weird in that Products(5)/OrderedIn/$ref represents the set of entity references of order details referenced by the OrderedIn nav prop of Products(5). More significantly, it doesn't work for containment scenarios, or anywhere there is no navigationpropertybinding, as the key appended to the nav property is not guaranteed to uniquely identify the related entity.
The second problem is a manifestation of the first conceptual problem. In order to delete a relationship we need 3 pieces of information: (1) the source entity, (2) the navigation property, and (3) the id of the thing being no longer related. In a 1:1 or many:1 relationship the id of the thing being removed is implicit, but in many:many we need to specify which thing to unrelated. The current syntax assumes that this information can be derived by applying the key to the nav prop, but this alone is not sufficient.
For collections, we could append id to the URL representing the collection of links, as in:
DELETE ~Products(5)/OrderedIn/$ref/OrderDetails(1)
for non-contained OrderDetails, or:
DELETE ~Products(5)/OrderedIn/$ref/Orders(123)/Details(1)
for contained OrderDetails
For single-valued relationships we would simply omit the id, since it points to a single references (and is therefore not valid to index with an id)