Skip to content

Commit 84a7143

Browse files
authored
Update naming guidance for id properties, transitiveChildren properties, and completedDateTime common property name (#507)
1 parent 7c7544d commit 84a7143

File tree

2 files changed

+44
-35
lines changed

2 files changed

+44
-35
lines changed

graph/GuidelinesGraph.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Following is a short summary of the most often used conventions.
104104
| **CASING** | |
105105
| :heavy_check_mark: **MUST** use lower camel case for *all* names and namespaces. | - **Right:** automaticRepliesStatus <BR> - **Wrong:** kebab-case or snake_case |
106106
| :ballot_box_with_check: **SHOULD** case two-letter acronyms with the same case. | - **Right:** ioLimit or totalIOAmount <BR> - **Right:** 'id' properties similar to driveId or applicationId <BR> - **Wrong:** iOLimit or totalIoAmount|
107+
| :ballot_box_with_check: **SHOULD** case `id` properties the same as a normal word. | - **Right:** id or fileId <BR> - **Wrong:** ID or fileID |
107108
| :ballot_box_with_check: **SHOULD** case three+ letter acronyms the same as a normal word. | - **Right:** fidoKey or oauthUrl <BR> - **Wrong:** webHTML |
108109
| :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, geo coordinate, or crosswalk <BR> - **Wrong:** metaData, semiCircle, or airPlane |
109110
| :heavy_check_mark: **MUST** capitalize within hyphenated and open (spaced) compound words. | - **Right:** fiveYearOld, daughterInLaw, or postOffice <BR> - **Wrong:** paperclip or fullmoon |
@@ -116,6 +117,13 @@ Following is a short summary of the most often used conventions.
116117
| :no_entry: **MUST NOT** use collection, response, or request suffixes. | - **Right:** addresses <BR> - **Wrong:** addressCollection |
117118
| :no_entry: **MUST NOT** contain product names. | - **Right:** chatMessages <BR> - **Wrong:** teamsMessages |
118119

120+
#### Tree and graph structures
121+
122+
When a tree or graph structure is being modeled, the direct sub-nodes are usually named `children` or `members`.
123+
If a property is desired that represents a "flattened" data structure, the property **SHOULD** be prefixed with "transitive", e.g. `transitiveChildren` or `transitiveMembers`.
124+
Such properties **MUST** represent a mathematically [transitive relationship](https://en.wikipedia.org/wiki/Transitive_relation).
125+
To simplify, if `A` is a child of `B` and `B` is a child of `C`, then `A` is a child of `C` via a transitive relationship; this **MUST** be true for properties using word "transitive" in their name.
126+
119127
### Uniform Resource Locators (URLs)
120128

121129
A Uniform Resource Locator (URL) is how developers access the resources of your API.

graph/articles/naming.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,40 @@ Where services have a property, whose data matches the names below, the service
6060
This table will grow as services add terms that will be more commonly used.
6161
Service owners adding such terms SHOULD propose additions to this document.
6262

63-
| |
64-
|------------- |
65-
attendees |
66-
body |
67-
createdDateTime |
68-
childCount |
69-
children |
70-
contentUrl |
71-
country |
72-
createdBy |
73-
displayName |
74-
errorUrl |
75-
eTag |
76-
event |
77-
expirationDateTime |
78-
givenName |
79-
jobTitle |
80-
kind |
81-
id |
63+
| | |
64+
|-------------------- | - |
65+
attendees |
66+
body |
67+
completedDateTime | **NOTE** completionDateTime may be used for cases where the timestamp represents a point in the future |
68+
createdDateTime |
69+
childCount |
70+
children |
71+
contentUrl |
72+
country |
73+
createdBy |
74+
displayName |
75+
errorUrl |
76+
eTag |
77+
event |
78+
expirationDateTime |
79+
givenName |
80+
jobTitle |
81+
kind |
82+
id |
8283
lastModifiedDateTime |
83-
location |
84-
memberOf |
85-
message |
86-
name |
87-
owner |
88-
people |
89-
person |
90-
postalCode |
91-
photo |
92-
preferredLanguage |
93-
properties |
94-
signInName |
95-
surname |
96-
tags |
97-
userPrincipalName |
98-
webUrl |
84+
location |
85+
memberOf |
86+
message |
87+
name |
88+
owner |
89+
people |
90+
person |
91+
postalCode |
92+
photo |
93+
preferredLanguage |
94+
properties |
95+
signInName |
96+
surname |
97+
tags |
98+
userPrincipalName |
99+
webUrl |

0 commit comments

Comments
 (0)