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
+29-29Lines changed: 29 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ Azure Service teams should engage the Azure HTTP/REST Stewardship Board early in
7
7
8
8
It is critically important to design your service to avoid disrupting users as the API evolves:
9
9
10
-
> :white_check_mark:**DO** implement API versioning starting with the very first release of the service.
11
-
>
12
-
> :white_check_mark:**DO** ensure that customer workloads never break
13
-
>
14
-
> :white_check_mark:**DO** ensure that customers are able to adopt a new version of service or SDK client library <b>without requiring code changes</b>
10
+
:white_check_mark:**DO** implement API versioning starting with the very first release of the service.
11
+
12
+
:white_check_mark:**DO** ensure that customer workloads never break
13
+
14
+
:white_check_mark:**DO** ensure that customers are able to adopt a new version of service or SDK client library <b>without requiring code changes</b>
15
15
16
16
### Azure Management Plane vs Data Plane
17
17
*Note: Developing a new service requires the development of at least 1 (management plane) API and potentially one or more additional (data plane) APIs. When reviewing v1 service APIs, we see common advice provided during the review.*
@@ -46,33 +46,33 @@ It is important to realize that writing an API is, in many cases, the easiest pa
46
46
47
47
Focusing on hero scenarios reduces development, support, and maintenance costs; enables teams to align and reach consensus faster; and accelerates the time to delivery. A telltale sign of a service that has not focused on hero scenarios is "API drift," where endpoints are inconsistent, incomplete, or juxtaposed to one another.
48
48
49
-
> :white_check_mark:**DO** define "hero scenarios" first including abstractions, naming, relationships, and then define the API describing the operations required
50
-
>
51
-
> :white_check_mark:**DO** provide example code demonstrating the "Hero Scenarios"
49
+
:white_check_mark:**DO** define "hero scenarios" first including abstractions, naming, relationships, and then define the API describing the operations required
50
+
51
+
:white_check_mark:**DO** provide example code demonstrating the "Hero Scenarios"
52
52
53
-
> :white_check_mark:**DO** consider how your abstractions will be represented in different high-level languages.
53
+
:white_check_mark:**DO** consider how your abstractions will be represented in different high-level languages.
54
54
55
-
> :white_check_mark:**DO** develop code examples in at least one dynamically typed language (for example, Python or JavaScript) and one statically typed language (for example, Java or C#) to illustrate your abstractions and high-level language representations.
55
+
:white_check_mark:**DO** develop code examples in at least one dynamically typed language (for example, Python or JavaScript) and one statically typed language (for example, Java or C#) to illustrate your abstractions and high-level language representations.
56
56
57
-
> :no_entry:**DO NOT** proactively add APIs for speculative features customers might want
57
+
:no_entry:**DO NOT** proactively add APIs for speculative features customers might want
58
58
59
59
### Start with your API Definition
60
60
Understanding how your service is used and defining its model and interaction patterns--its API--should be one of the earliest activities a service team undertakes. It reflects the abstractions & naming decisions and makes it easy for developers to implement the hero scenarios.
61
61
62
-
> :white_check_mark:**DO** create an [OpenAPI Definition](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) (with [autorest extensions](https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md)) describing the service. The OpenAPI definition is a key element of the Azure SDK plan and is essential for documentation, usability and discoverability of services.
62
+
:white_check_mark:**DO** create an [OpenAPI Definition](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) (with [autorest extensions](https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md)) describing the service. The OpenAPI definition is a key element of the Azure SDK plan and is essential for documentation, usability and discoverability of services.
63
63
64
64
### Use Previews to Iterate
65
65
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.
66
66
67
-
> :ballot_box_with_check:**YOU SHOULD** write and test hypotheses about how your customers will use the API.
68
-
>
69
-
> :ballot_box_with_check:**YOU SHOULD** release and evaluate a minimum of 2 preview versions prior to the first GA release.
70
-
>
71
-
> :ballot_box_with_check:**YOU SHOULD** identify key scenarios or design decisions in your API that you want to test with customers, and ask customers for feedback and to share relevant code samples.
72
-
>
73
-
> :ballot_box_with_check:**YOU SHOULD** consider doing a *code with* exercise in which you actively develop with the customer, observing and learning from their API usage.
74
-
>
75
-
> :ballot_box_with_check:**YOU SHOULD** capture what you have learned during the preview stage and share these findings with your team and with the API Stewardship Board.
67
+
:ballot_box_with_check:**YOU SHOULD** write and test hypotheses about how your customers will use the API.
68
+
69
+
:ballot_box_with_check:**YOU SHOULD** release and evaluate a minimum of 2 preview versions prior to the first GA release.
70
+
71
+
:ballot_box_with_check:**YOU SHOULD** identify key scenarios or design decisions in your API that you want to test with customers, and ask customers for feedback and to share relevant code samples.
72
+
73
+
:ballot_box_with_check:**YOU SHOULD** consider doing a *code with* exercise in which you actively develop with the customer, observing and learning from their API usage.
74
+
75
+
:ballot_box_with_check:**YOU SHOULD** capture what you have learned during the preview stage and share these findings with your team and with the API Stewardship Board.
76
76
77
77
### Avoid Surprises
78
78
A major inhibitor to adoption and usage is when an API behaves in an unexpected way. Often, these are subtle design decisions that seem benign at the time, but end up introducing significant downstream friction for developers.
@@ -81,15 +81,15 @@ One common area of friction for developers is _polymorphism_ -- where a value ma
81
81
Polymorphism can be beneficial in certain cases, e.g. as a way to express inheritance, but also creates friction
82
82
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.
83
83
84
-
> :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.
85
-
>
86
-
> :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.
87
-
>
84
+
: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.
85
+
86
+
: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.
87
+
88
88
Collections are another common area of friction for developers. It is important to define collections in a consistent manner within your service and across services of the platform. In particular, features such as pagination, filtering, and sorting, when supported, should follow common API patterns. See [Collections](./Guidelines.md#collections) for specific guidance.
89
89
90
90
An important consideration when defining a new service is support for pagination.
91
91
92
-
> :ballot_box_with_check:**YOU SHOULD** support server-side paging, even if your resource does not currently need paging. This avoids a breaking change when your service expands. See [Collections](./Guidelines.md#collections) for specific guidance.
92
+
:ballot_box_with_check:**YOU SHOULD** support server-side paging, even if your resource does not currently need paging. This avoids a breaking change when your service expands. See [Collections](./Guidelines.md#collections) for specific guidance.
93
93
94
94
Another important design pattern for avoiding surprises is idempotency. An operation is idempotent if it can be performed multiple times and have the same result as a single execution.
95
95
HTTP requires certain operations like GET, PUT, and DELETE to be idempotent, but for cloud services it is important to make _all_ operations idempotent so that clients can use retry in failure scenarios without risk of unintended consequences.
@@ -98,9 +98,9 @@ See the [HTTP Request / Response Pattern section of the Guidelines](./Guidelines
98
98
### Design for Change Resiliency
99
99
As you build out your service and API, there are a number of decisions that can be made up front that add resiliency to client implementations. Addressing these as early as possible will help you iterate faster and avoid breaking changes.
100
100
101
-
> :ballot_box_with_check:**YOU SHOULD** use extensible enumerations. Extensible enumerations are modeled as strings - expanding an extensible enumeration is not a breaking change.
102
-
>
103
-
> :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.
101
+
:ballot_box_with_check:**YOU SHOULD** use extensible enumerations. Extensible enumerations are modeled as strings - expanding an extensible enumeration is not a breaking change.
102
+
103
+
: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.
104
104
105
105
## Getting Help: The Azure REST API Stewardship Board
106
106
The Azure REST API Stewardship board is a collection of dedicated architects that are passionate about helping Azure service teams build interfaces that are intuitive, maintainable, consistent, and most importantly, delight our customers. Because APIs affect nearly all downstream decisions, you are encouraged to reach out to the Stewardship board early in the development process. These architects will work with you to apply these guidelines and identify any hidden pitfalls in your design.
0 commit comments