Skip to content

Commit d88d376

Browse files
committed
Merge branch 'dm/navigationproperties' of https://github.com/microsoft/api-guidelines into dm/navigationproperties
2 parents c39ce1d + c28cf0e commit d88d376

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

graph/patterns/navigation-property.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ The use of foreign key properties to describe related resources is a weakly type
1616
## Solution
1717
--------
1818

19-
Navigation properties are an [OData convention](https://docs.microsoft.com/en-us/odata/webapi/model-builder-untyped#navigation-property) defined in the [CSDL Specification](https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html#_Toc38530365) that allows an API designer to describe a special kind of property in a model that references an related entity. In the HTTP API this property name translates to a path segment that can be appended to the URL of the primary resource in order to access a representation of the related resource. This prevents the client from needing to know any additional information on how to construct the URL to the related resource and the client does not need to retrieve the primary resource if it is only interested in the related resource. It is the responsibility of the API implementation to determine the Id of the related resource and return the representation of the related entity.
19+
Navigation properties are an [OData convention](https://docs.microsoft.com/en-us/odata/webapi/model-builder-untyped#navigation-property) defined in the [CSDL Specification](https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html#_Toc38530365) that allows an API designer to describe a special kind of property in a model that references an related entity. In the HTTP API this property name translates to a path segment that can be appended to the URL of the primary resource in order to access a representation of the related resource. This prevents the client from needing to know any additional information on how to construct the URL to the related resource and the client does not need to retrieve the primary resource if it is only interested in the related resource. It is the responsibility of the API implementation to determine the Id of the related resource and return the representation of the related entity. For example:
2020

21-
e.g. /user/{userId}/manager # many-to-one relationship
22-
/user/{userId}/messages # one-to-many relationship
21+
- /user/{userId}/manager represents many-to-one relationship
22+
- /user/{userId}/messages represents one-to-many relationship
2323

24-
Additionally, using the OData Expand query parameter, related entities can be transcluded into the primary entity so both can be retrieved in a single round trip.
24+
Additionally, using the OData Expand query parameter, related entities can be nested into the primary entity so both can be retrieved in a single round trip.
2525

2626
These relationships can be described in CSDL as follows:
2727

@@ -100,7 +100,6 @@ GET /users/{id}/manager
100100
Content-Type: application/json
101101
102102
{
103-
"@odata.type": "#microsoft.graph.user",
104103
"id": "6b3ee805-c449-46a8-aac8-8ff9cff5d213",
105104
"displayName": "Bob Boyce"
106105
}
@@ -109,10 +108,10 @@ Content-Type: application/json
109108
This navigation property could be described with the following CSDL:
110109
```xml
111110
<EntityType Name="user">
112-
<NavigationProperty Name="manager" Type="user" ContainsTarget="false" >
111+
<NavigationProperty Name="manager" Type="graph.user" ContainsTarget="false" >
113112
</EntityType>
114113
```
115-
114+
`ContainsTarget` is set to false for clarity, this is the default value when the attribute is omitted.
116115
### Retrieving a reference to a related entity
117116

118117
```http

0 commit comments

Comments
 (0)