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: azure/ConsiderationsForServiceDesign.md
+60-1Lines changed: 60 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,65 @@ As you build out your service and API, there are a number of decisions that can
84
84
85
85
:ballot_box_with_check:**YOU SHOULD** implement [conditional requests](https://tools.ietf.org/html/rfc7232) early. This allows you to support concurrency, which tends to be a concern later on.
86
86
87
+
## Use Good Names
88
+
89
+
Good names for resources, properties, operations, and parameters are essential to a good developer experience.
90
+
91
+
Resources are typically described by nouns. Resource and property names must be descriptive and easy to understand for end-users. Ease of understanding comes from familiarity and recognition; you should favor consistency with other Azure services, names in the product user interface, and industry standards.
92
+
93
+
Names should aid developers in discovering functionality without having to constantly refer to documentation.
94
+
Use common patterns and standard conventions to aid developers in correctly guessing common property names and meanings.
95
+
Use verbose naming patterns and avoid abbreviations other than
96
+
well-known acronyms in your service domain.
97
+
98
+
### Recommended Naming Conventions
99
+
100
+
The following are recommended naming conventions for Azure services:
101
+
102
+
:heavy_check_mark:**DO** use singular nouns for resource (schema) names.
103
+
104
+
:heavy_check_mark:**DO** use plural nouns for collections (for listing type or collection properties).
105
+
106
+
:ballot_box_with_check:**YOU SHOULD** case all acronyms the same as a normal word.
107
+
108
+
For example, `nextUrl` and not `nextURL`.
109
+
110
+
:ballot_box_with_check:**YOU SHOULD** use "at" suffix in names of `date-time` values.
111
+
112
+
:ballot_box_with_check:**YOU SHOULD** use "is" prefix in names of `boolean` values.
113
+
114
+
:ballot_box_with_check:**YOU SHOULD** use a suffix of the unit of measurement for values with a clear unit of measurement (such as bytes, miles, and so on). Use a generally accepted abbreviation for the units (e.g. "km" rather than "kilometers") when appropriate.
115
+
116
+
:ballot_box_with_check:**YOU SHOULD** use an int for time durations and include the time units in the name.
117
+
118
+
For example, `expirationDays` as `int` and not `expiration` as `date-time`.
119
+
120
+
:ballot_box_with_check:**YOU SHOULD** prefix property names for properties concerning a different resource, particular for resource identifiers.
121
+
122
+
:warning:**YOU SHOULD NOT** use brand names in resource or property names.
123
+
124
+
:warning:**YOU SHOULD NOT** use acronyms or abbreviations unless they are broadly understood.
125
+
126
+
:no_entry:**DO NOT** use redundant words in names.
127
+
128
+
For example, `/phones/number` and not `phone/phoneNumber`.
129
+
130
+
:no_entry:**DO NOT** use a "request", "response", or "collection" suffix on resource names.
131
+
132
+
### Common names
133
+
134
+
The following are recommended names for properties that match the associated description:
135
+
136
+
| Name | Description |
137
+
|------------- | --- |
138
+
| createdAt | The date-time that the resource was created |
139
+
| updatedAt | The date-time that the resource was last updated/modified |
140
+
| kind | The discriminator value for a polymorphic resource |
141
+
142
+
### `name` vs `id`
143
+
144
+
The identifier of a resource should be named `id`. This holds even in the case where the identifier is assigned by the user with a PUT method.
145
+
87
146
## Use Previews to Iterate
88
147
Before releasing your API plan to invest significant design effort, get customer feedback, & iterate through multiple preview releases. This is especially important for V1 as it establishes the abstractions and patterns that developers will use to interact with your service.
89
148
@@ -111,7 +170,7 @@ One common area of friction for developers is _polymorphism_ -- where a value ma
111
170
Polymorphism can be beneficial in certain cases, e.g. as a way to express inheritance, but also creates friction
112
171
because it requires the value to be introspected before being processed and cannot be represented in a natural/useful way in many type-safe languages.
113
172
114
-
:ballot_box_with_check:**YOU SHOULD** avoid polymorphism, especially in the response. An endpoint **SHOULD** work with a single type to avoid problems during SDK creation.
173
+
:ballot_box_with_check:**YOU SHOULD** avoid polymorphism, especially in the response. An endpoint **YOU SHOULD** work with a single type to avoid problems during SDK creation.
115
174
116
175
:ballot_box_with_check:**YOU SHOULD** return a homogeneous collection (single type). Do not return heterogeneous collections unless there is a really good reason to do so. If you feel heterogeneous collections are required, discuss the requirement with an API reviewer prior to implementation.
0 commit comments