Skip to content

Commit bf5bb78

Browse files
committed
More edits to this page
1 parent 543f87c commit bf5bb78

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

graph/patterns/subsets.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,23 @@
22

33
Microsoft Graph API Design Pattern
44

5-
The modeling collection subsets pattern is the modeling state associated to a collection that may include all instances, an included subset, an excluded subset, no instances, or any combinations of the preceding items.
5+
*The modeling collection subsets pattern is the modeling state associated to a collection that may include all instances, an included subset, an excluded subset, no instances, or any combinations of the preceding items.*
6+
7+
## Problem
68

79
A common pattern is to apply a policy or state to a collection of objects. With this, there also comes the question of how to model cases where we want to apply to 'all' or 'none' without having to special case these values within the collection set or introduce cross-property dependencies. Likewise, we'd like to model it in a way where it is easy to understand and interpret usage from just looking at the schema.
810

911
An example is where you have a policy that you need to be able to apply to users in an organization. You might want to support the default **None**, enablement for **All**, or enablement for **Select** users where you only grant it to a few users.
1012

11-
## Problem
12-
13-
--------
14-
1513
Existing patterns for this either have special-cased 'strings' or have tightly coupled dependencies between two independent properties. Neither is intuitive, both require reading documentation, and neither can be inferred from the schema or within client libraries.
1614

1715
## Solution
1816

19-
--------
20-
2117
Have an abstract base class where all 'variants' of the subset are derived types from the base subset. For more information, see the [general subtyping guidance](https://github.com/microsoft/api-guidelines/blob/graph/graph/patterns/subtypes.md).
2218

2319
The abstract base class should also hold an enum for all possible variants. The purpose of including this is to allow for easier ways to do query and filter operations on variants like 'all' and 'none' without relying on `isof` functions.
2420

25-
Base type
21+
**Base type**
2622

2723
```xml
2824
<ComplexType Name="membership" IsAbstract="true">
@@ -37,7 +33,7 @@ Base type
3733
</Enum>
3834
```
3935

40-
Derived types
36+
**Derived types**
4137

4238
```xml
4339
<ComplexType Name="noMembership" BaseType="graph.membership"/>
@@ -75,8 +71,6 @@ Be aware that the name values and types in the preceding examples are just examp
7571

7672
## When to use this pattern
7773

78-
--------
79-
8074
Use this pattern when supporting two or more collection states of the following, where at least one of the states is a subset variant:
8175

8276
- All targets
@@ -88,17 +82,15 @@ If you only ever need to support two states&mdash;All or None&mdash;without usin
8882

8983
## Issues and considerations
9084

91-
--------
92-
9385
Given that we are using an overarching subtype model, subtyping model limitations apply here as well; for more details, see the [subtyping documentation](https://github.com/microsoft/api-guidelines/blob/graph/graph/Modelling%20with%20Subtypes%20Pattern.md).
9486

9587
## Example
9688

97-
--------
98-
89+
```http
9990
GET https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies/
91+
```
10092

101-
_Note: unrelated properties on entities are omitted for easier readability_
93+
_Note: Unrelated properties on entities are omitted for easier readability._
10294

10395
```json
10496
{
@@ -135,9 +127,11 @@ _Note: unrelated properties on entities are omitted for easier readability_
135127
}
136128
```
137129

130+
```http
138131
POST https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies/
132+
```
139133

140-
_Note: unrelated properties on entities are omitted for easier readability_
134+
_Note: Unrelated properties on entities are omitted for easier readability._
141135

142136
```json
143137
{
@@ -156,9 +150,11 @@ _Note: unrelated properties on entities are omitted for easier readability_
156150

157151
or
158152

153+
```http
159154
POST https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies/
155+
```
160156

161-
_Note: unrelated properties on entities are omitted for easier readability_
157+
_Note: Unrelated properties on entities are omitted for easier readability._
162158

163159
```json
164160
{

0 commit comments

Comments
 (0)