Skip to content

Commit dd41040

Browse files
authored
Merge pull request #483 from microsoft/corranrogue9/subsetsenum
Remove the requirement for an enum property in the collection subsets pattern
2 parents 15fefba + 0d8f4e4 commit dd41040

File tree

1 file changed

+66
-8
lines changed

1 file changed

+66
-8
lines changed

graph/patterns/subsets.md

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ Existing patterns for this either have special-cased strings or have tightly cou
1616

1717
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](./subtypes.md).
1818

19-
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.
19+
The abstract base class may also optionally hold an `enum` for the different variants. If it does, the `enum` must have a member 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.
2020

21-
**Base type**
21+
**Base type *without* an enum for the variants**
2222

2323
```xml
24-
<ComplexType Name="membership" IsAbstract="true">
24+
<ComplexType Name="membershipBase" IsAbstract="true" />
25+
```
26+
27+
**Base type *with* an enum for the variants**
28+
29+
```xml
30+
<ComplexType Name="membershipBase" IsAbstract="true">
2531
<Property Name="membershipKind" Type="graph.membershipKind"/>
2632
</ComplexType>
2733

@@ -36,15 +42,15 @@ The abstract base class should also hold an enum for all possible variants. The
3642
**Derived types**
3743

3844
```xml
39-
<ComplexType Name="noMembership" BaseType="graph.membership"/>
45+
<ComplexType Name="noMembership" BaseType="graph.membershipBase"/>
4046

41-
<ComplexType Name="allMembership" BaseType="graph.membership"/>
47+
<ComplexType Name="allMembership" BaseType="graph.membershipBase"/>
4248

43-
<ComplexType Name="enumeratedMembership" BaseType = "graph.membership">
49+
<ComplexType Name="enumeratedMembership" BaseType = "graph.membershipBase">
4450
<Property Name="members" Type="Collection(Edm.String)"/>
4551
</ComplexType>
4652

47-
<ComplexType Name="excludedMembership" BaseType="graph.membership">
53+
<ComplexType Name="excludedMembership" BaseType="graph.membershipBase">
4854
<Property Name="members" Type="Collection(Edm.String)"/>
4955
</ComplexType>
5056
```
@@ -53,7 +59,7 @@ Be aware that the name values and types in the preceding examples are just examp
5359

5460
These pattern type names should satisfy the following naming conventions:
5561

56-
- The base type name should have the suffix `Base`, and the enumeration type name should have the suffix `Kind`.
62+
- The base type name should have the suffix `Base`, and the enumeration type name (if an `enum` is defined) should have the suffix `Kind`.
5763
- Derived child types should have names with enumeration values as the prefixes; for example, if the enumeration member value is `value1`, then the derived type name is `value1<type>`.
5864

5965
```xml
@@ -176,3 +182,55 @@ _Note: Unrelated properties on entities are omitted for easier readability._
176182
}
177183
}
178184
```
185+
186+
### Filter when base type has the "kind" enum property
187+
188+
```http
189+
GET https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies?$filter=conditions/users/includeGuestsOrExternalUsers/externalTenants/membershipKind eq 'all'
190+
191+
200 OK
192+
{
193+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#conditionalAccessPolicy",
194+
"values": [
195+
{
196+
"id": "66d36273-fe4c-d478-dc22-e0179d856ce7",
197+
"conditions": {
198+
"users": {
199+
"includeGuestsOrExternalUsers": {
200+
"externalTenants": {
201+
"@odata.type":"microsoft.graph.conditionalAccessAllExternalTenants",
202+
"membershipKind": "all"
203+
}
204+
}
205+
}
206+
}
207+
}
208+
]
209+
}
210+
```
211+
212+
### Filter when base type lacks the "kind" enum property
213+
214+
```HTTP
215+
GET https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies?$filter=isof(conditions/users/includeGuestsOrExternalUsers/externalTenants, microsoft.graph.conditionalAccessAllExternalTenants)
216+
217+
200 OK
218+
{
219+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#conditionalAccessPolicy",
220+
"values": [
221+
{
222+
"id": "66d36273-fe4c-d478-dc22-e0179d856ce7",
223+
"conditions": {
224+
"users": {
225+
"includeGuestsOrExternalUsers": {
226+
"externalTenants": {
227+
"@odata.type":"microsoft.graph.conditionalAccessAllExternalTenants",
228+
"membershipKind": "all"
229+
}
230+
}
231+
}
232+
}
233+
}
234+
]
235+
}
236+
```

0 commit comments

Comments
 (0)