Skip to content

Commit 19c9472

Browse files
committed
added flat bag
1 parent 40abe33 commit 19c9472

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

graph/patterns/flat-bag.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Flat Bag Pattern
2+
3+
Microsoft Graph API Design Pattern
4+
5+
### *A known pattern in Microsoft Graph is to model multiple variants of a common concept as a single entity type with all the potential properties plus an additional property to distinguish the variants.*
6+
7+
8+
## Problem
9+
10+
API designer needs to model a small and limited number of variants of a common concept with a concise list of non-overlapping properties and consistent behavior across variant. The designer also wants to simplify query construction.
11+
12+
## Solution
13+
14+
The API designer creates one entity type with all the potential properties plus an additional property to distinguish the variants, often called `variantType`.
15+
16+
## Issues and Considerations
17+
18+
????
19+
20+
21+
## When to Use this Pattern
22+
23+
The flat-bag pattern is useful when there is a small number of variants
24+
25+
????
26+
27+
There are related patterns to consider such as
28+
[Type Hierarchy](https://github.com/microsoft/api-guidelines/tree/graph/graph) and [Flat
29+
bag of
30+
properties](https://github.com/microsoft/api-guidelines/tree/graph/graph).
31+
32+
## Example
33+
?????

graph/patterns/subtypes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Response payload shortened for readability:
106106
    ]
107107
}
108108
```
109-
API request for a subtype specific property requires type casting to the subtype, i.e. to retrieve jobTitle property, enabled for the user type, you need to cast from the directoryObject collection items to the microsoft.graph.group derived type.
109+
API request for a subtype specific property requires type casting to the subtype, i.e. to retrieve jobTitle property, enabled for the user type, you need to cast from the directoryObject collection items to the microsoft.graph.user derived type.
110110

111111
```
112112
GET https://graph.microsoft.com/v1.0/groups/a94a666e-0367-412e-b96e-54d28b73b2db/members/microsoft.graph.user?$select=displayName,jobTitle

0 commit comments

Comments
 (0)