Skip to content

Commit e8a0050

Browse files
committed
generic context
1 parent 237d3a6 commit e8a0050

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

graph/GuidelinesGraph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Below is a short summary of the most often used conventions.
167167
| :ballot_box_with_check: **SHOULD** use the Duration type for durations, but if using an int, append the units. | - **Right:** passwordValidityPeriod — an Edm.Duration <BR> - **Right:** passwordValidityPeriodInDays — an Edm.Int32 (NOTE use of Edm.Duration type is preferable) <BR>- **Wrong** passwordValidityPeriod — an Edm.Int32 |
168168
| :no_entry: **MUST NOT** use suffix property names with primitive type names unless the type is temporal. | - **Right:** isEnabled or amount <BR> - **Wrong** enabledBool |
169169
| :ballot_box_with_check: **SHOULD** prefix property names for properties concerning a different entity. | - **Right:** siteWebUrl on driveItem, or userId on auditActor <BR> - **Wrong** webUrl on contact when its the companyWebUrl |
170-
| :ballot_box_with_check: **SHOULD** prefix Boolean properties with is, unless this leads to awkward or unnatural sounding names for Boolean properties. | - **Right:** isEnabled or isResourceAccount <BR>- **Wrong** enabled or allowResourcAccount <BR> - **Right:** allowNewTimeProposals or allowInvitesFrom — subjectively more natural than the examples below <BR> - **Wrong** isNewTimeProposalsAllowed or isInvitesFromAllowed — subjectively more awkward that the examples above |
170+
| :ballot_box_with_check: **SHOULD** prefix Boolean properties with is, unless this leads to awkward or unnatural sounding names for Boolean properties. | - **Right:** isEnabled or isResourceAccount <BR>- **Wrong** enabled or allowResourceAccount <BR> - **Right:** allowNewTimeProposals or allowInvitesFrom — subjectively more natural than the examples below <BR> - **Wrong** isNewTimeProposalsAllowed or isInvitesFromAllowed — subjectively more awkward that the examples above |
171171
| :no_entry: **MUST NOT** use 'collection', 'response', 'request ' suffixes . |- **Right:** addresses <BR> - **Wrong** addressCollection |
172172

173173
### Uniform Resource Locators (URLs)

graph/Modelling with Subtypes Pattern.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ Microsoft Graph API Design Pattern
1010

1111
## Context
1212

13-
Let’s assume you need to model an API to manage groups in an
13+
Often an API needs to serve business entities which come in slightly different variation. These entities can be represented as a type hierarchy similar to the OOP inheritance concept. The hierarchy will be modeled as a base type and multiple subtypes which represent variations in metadata and behavior. In this model common elements of the base type can be reused, extended, or modified by subtypes.
14+
15+
For example let’s assume you need to model an API to manage groups in an
1416
organization, where employees can create groups and become owners of the
1517
group by default. At the same time to support business processes some
1618
groups may be created automatically by daemon applications using a
@@ -24,13 +26,12 @@ description.
2426

2527

2628
## Problem
29+
How to design an API to work with a collection of heterogeneous elements that have a set of common properties and behaviors, and some unique properties for each variant. Furthermore, it should be straightforward to add new variants to the API as needed in the future.
30+
2731

28-
How to model group owners to allow a heterogeneous collection of users
29-
and principles so that API design can reflect common and relevant
30-
properties for each subset of owners and accommodate new owner types in
31-
future?
32+
Or as in previous example how to model group owners to allow a heterogeneous collection of users
33+
and principles and be able to accommodate new owner types in future?
3234

33-
A more general problem is how to model a collection of heterogeneous elements that have a set of common properties and behaviors, and some unique properties for each variant. Furthermore, it should be straightforward to add new variants to the API as needed in the future.
3435

3536
## Solution
3637
--------

0 commit comments

Comments
 (0)