You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: graph/GuidelinesGraph.md
+19-21Lines changed: 19 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,35 +133,33 @@ identify potential error scenarios with secure and descriptive messaging.
133
133
Consistent naming is foundational for API usability. API resources are typically
134
134
described by nouns. You need to consider that resources and property names
135
135
appear in API URLs and payloads and should be descriptive and easy to
136
-
understand. Therefore you should satisfy the following requirements summarized in the table below:
136
+
understand. Microsoft Graph naming conventions follow [Microsoft REST API Guidelines](https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md). Below is a short summary of the most often used conventions.
|:no_entry:**DO NOT** use redundant words in names. |- **Right:** /places/{id}/**type** and /phones/{id}/**number** <BR> - **Wrong** /places/{id}/*placeType* and /phones/{id}/**phoneNumber**|
140
-
|:no_entry:**DO NOT** use brand names in type or property names. | - **Right:** chat <BR> - **Wrong** teamsChat |
141
-
|:no_entry:**DO NOT** use acronyms or abbreviations unless they are broadly understood. | - **Right:** url or htmlSignature <BR> - **Wrong** msodsUrl or dlp |
142
-
|:heavy_check_mark:**DO** use singular nouns for type names. | - **Right:** address <BR> - **Wrong** addresses |
143
-
|:heavy_check_mark:**DO** use plural nouns for collections (for listing a type or collection properties). | - **Right:** addresses <BR> - **Wrong** address |
144
-
|:heavy_check_mark:**DO** pluralize the noun even when followed by an adjective (a "postpositive"). | - **Right:** passersby or mothersInLaw <BR> - **Wrong** notaryPublics or motherInLaws |
145
-
|:heavy_check_mark:**DO** name property as “email” | - **Right:** email <BR> - **Wrong** mail |
139
+
|:no_entry:**MUST NOT** use redundant words in names. |- **Right:** /places/{id}/**type** and /phones/{id}/**number** <BR> - **Wrong** /places/{id}/*placeType* and /phones/{id}/**phoneNumber**|
140
+
|:no_entry:**SHOULD NOT** use brand names in type or property names. | - **Right:** chat <BR> - **Wrong** teamsChat |
141
+
|:no_entry:**SHOULD NOT** use acronyms or abbreviations unless they are broadly understood. | - **Right:** url or htmlSignature <BR> - **Wrong** msodsUrl or dlp |
142
+
|:heavy_check_mark:**MUST** use singular nouns for type names. | - **Right:** address <BR> - **Wrong** addresses |
143
+
|:heavy_check_mark:**MUST** use plural nouns for collections (for listing a type or collection properties). | - **Right:** addresses <BR> - **Wrong** address |
144
+
|:heavy_check_mark:**SHOULD** pluralize the noun even when followed by an adjective (a "postpositive"). | - **Right:** passersby or mothersInLaw <BR> - **Wrong** notaryPublics or motherInLaws |
|:heavy_check_mark:**DO** use lower camel case for *all* names and namespaces | - **Right:** automaticRepliesStatus. <BR> - **Wrong** kebab-case or snake_case. |
151
-
|:heavy_check_mark:**DO** case two-letter acronyms with the same case. | - **Right:** ioLimit or totalIOAmount <BR> - **Wrong** iOLimit or totalIoAmount |
152
-
|:heavy_check_mark:**DO** case three+ letter acronyms the same as a normal word. | - **Right:** fidoKey or oauthUrl <BR> - **Wrong** webHTML |
153
-
|:no_entry:**DO NOT** capitalize the word following a [prefix](https://www.thoughtco.com/common-prefixes-in-english-1692724) or words within a [compound word](http://www.learningdifferences.com/Main%20Page/Topics/Compound%20Word%20Lists/Compound_Word_%20Lists_complete.htm). | - **Right:** subcategory, geocoordinate or crosswalk <BR> - **Wrong** metaData, semiCircle or airPlane |
154
-
|:heavy_check_mark:**DO** capitalize within hyphenated and open (spaced) compound words. | - **Right:** fiveYearOld, daughterInLaw or postOffice <BR> - **Wrong** paperclip or fullmoon |
149
+
|:heavy_check_mark:**Must** use lower camel case for *all* names and namespaces | - **Right:** automaticRepliesStatus. <BR> - **Wrong** kebab-case or snake_case. |
150
+
|:heavy_check_mark:**Should** case two-letter acronyms with the same case. | - **Right:** ioLimit or totalIOAmount <BR> - **Wrong** iOLimit or totalIoAmount |
151
+
|:heavy_check_mark:**Should** case three+ letter acronyms the same as a normal word. | - **Right:** fidoKey or oauthUrl <BR> - **Wrong** webHTML |
152
+
|:no_entry:**Must NOT** capitalize the word following a [prefix](https://www.thoughtco.com/common-prefixes-in-english-1692724) or words within a [compound word](http://www.learningdifferences.com/Main%20Page/Topics/Compound%20Word%20Lists/Compound_Word_%20Lists_complete.htm). | - **Right:** subcategory, geocoordinate or crosswalk <BR> - **Wrong** metaData, semiCircle or airPlane |
153
+
|:heavy_check_mark:**MUST** capitalize within hyphenated and open (spaced) compound words. | - **Right:** fiveYearOld, daughterInLaw or postOffice <BR> - **Wrong** paperclip or fullmoon |
|:heavy_check_mark:**DO** use namespaces | Microsoft Graph model types can be declared within a [type namespaces](./type-namespaces.md) to reduce the need to prefix types with a qualifier to ensure uniqueness. |
160
-
|:heavy_check_mark:**DO** suffix date and time properties with | - **Right:** dueDate — an Edm.Date <BR> - **Right:** createdDateTime — an Edm.DateTimeOffset <BR> - **Right:** recurringMeetingTime — an Edm.TimeOfDay <BR> - **Wrong** dueOn or startTime - <BR> - **Right:** instead both above are an Edm.DateTimeOffset |
161
-
|:heavy_check_mark:**DO** 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|
162
-
|:no_entry:**DO NOT** use suffix property names with primitive type names unless the type is temporal.| - **Right:** isEnabled or amount <BR> - **Wrong** enabledBool|
163
-
|:heavy_check_mark:**DO** 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|
164
-
|:heavy_check_mark:**DO** 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 |
158
+
|:heavy_check_mark:**MUST** suffix date and time properties with | - **Right:** dueDate — an Edm.Date <BR> - **Right:** createdDateTime — an Edm.DateTimeOffset <BR> - **Right:** recurringMeetingTime — an Edm.TimeOfDay <BR> - **Wrong** dueOn or startTime - <BR> - **Right:** instead both above are an Edm.DateTimeOffset |
159
+
|:heavy_check_mark:**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|
160
+
|:no_entry:**MUST NOT** use suffix property names with primitive type names unless the type is temporal.| - **Right:** isEnabled or amount <BR> - **Wrong** enabledBool|
161
+
|:heavy_check_mark:**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|
162
+
|:heavy_check_mark:**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 |
165
163
166
164
### Uniform Resource Locators (URLs)
167
165
@@ -170,7 +168,7 @@ API.
170
168
171
169
Navigation path to the Microsoft Graph resources generally broken into multiple segments:
172
170
173
-
**{scheme}://{host}/{version}/{category}/{resourcePath}[?{query}]** where
171
+
**{scheme}://{host}/{version}/{category}/[{pathSegment}][?{query}]** where
0 commit comments