Skip to content

Commit dd3cfad

Browse files
authored
Merge pull request #366 from microsoft/garethj-msft-subtypes-updates
Update subtypes.md
2 parents fb2ca25 + 08fb3b0 commit dd3cfad

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

graph/patterns/subtypes.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22

33
Microsoft Graph API Design Pattern
44

5-
*A frequent pattern in Microsoft Graph is to have a small type hierarchy, a base type with a few subtypes. This lets us model collections of objects that have slightly different metadata and behavior.*
5+
*A frequent pattern in Microsoft Graph is to have a small type hierarchy, a base type with a few subtypes. This lets us model collections of resources that have slightly different metadata and behavior.*
66

77
## Problem
88

9-
The API design requires that we model a set of entities based on a common concept
9+
The API design requires that we model a set of resources based on a common concept
1010
that can be further grouped into *mutually exclusive variants* with specific
1111
properties and behaviors. The API design should be evolvable and allow the addition
1212
of new variants without breaking changes.
1313

1414
## Solution
1515

16-
API designers can use OData *type hierarchy*, where there is one abstract base
17-
type with a few shared properties representing the common concept and one
18-
subtype for each variant of the entity. In the hierarchy, the interdependencies of properties, that is, which properties are relevant for which variants, is fully captured in metadata, and client code can potentially leverage that to construct and/or validate requests.
16+
API designers might use a *type hierarchy*, where there is one base
17+
type (which might be abstract) with a few shared properties representing the common concept and one
18+
subtype for each variant of the resource. In the hierarchy, the interdependencies of properties, that is, which properties are relevant for which variants, is fully captured in the type system.
1919

2020
## When to use this pattern
2121

22-
The type hierarchy pattern is well suited to a use case where each variant of a
23-
common concept has unique properties and behaviors, no combination of variants
24-
is anticipated, and API queries are managed programmatically with type casting.
22+
Use this pattern where each variant of a common concept has its own unique properties and behaviors,
23+
no combination of variants is anticipated,
24+
and it is acceptable that callers who need to query resources by variant are adequately served by filtering or partitioning using type casting.
2525

26-
You can consider related patterns such as
27-
[Facets](https://github.com/microsoft/api-guidelines/tree/graph/graph) and [Flat bag of properties](https://github.com/microsoft/api-guidelines/tree/graph/graph).
26+
Related patterns are
27+
[Facets](facets.md) and
28+
[Flat bag of properties](flatbag.md).
2829

2930
## Issues and considerations
3031

@@ -131,4 +132,4 @@ POST https://graph.microsoft.com/v1.0/directoryObjects
131132
"mailNickname": "library",
132133
"securityEnabled": true
133134
}
134-
```
135+
```

0 commit comments

Comments
 (0)