@@ -7,22 +7,65 @@ placement:
77 order : 40
88---
99
10- # AIP Style guide
10+ # AIP Style and Guidance
1111
1212AIP stands for ** API Improvement Proposal** , which is a design document
13- providing high-level, concise documentation for API development. The goal is for
14- these documents to serve as the source of truth for API-related documentation at
15- Google and the way API teams discuss and come to consensus on API guidance.
13+ providing high-level, concise documentation for API design and development. The
14+ goal is for these documents to serve as the source of truth for API-related
15+ documentation at Google and the way API teams discuss and come to consensus on
16+ API guidance.
1617
1718AIPs are most useful when they are clear and concise, and cover a single topic
1819or inquiry well. In the same way that AIPs describe consistent patterns and
1920style for use in APIs, they also _ follow_ consistent patterns and style.
2021
2122## Guidance
2223
23- AIPs ** must** cover a single, discrete topic, and ** should** fundamentally
24- answer the question, "What do I do?" with actionable guidance. AIPs ** may** also
25- cover what _ not_ to do, but ** should not** cover _ only_ anti-patterns.
24+ - AIPs ** must** cover a single, discrete topic, and provide clear, actionable
25+ guidance.
26+ - AIPs ** must not** duplicate or contradict guidance in another AIP.
27+ - AIPs ** may** also cover what _ not_ to do, but ** should not** cover _ only_
28+ anti-patterns.
29+ - If AIP guidance is conditional (e.g. a design pattern such as Jobs), the
30+ guidance ** must** clearly explain under what conditions the guidance should be
31+ followed.
32+
33+ Guidance contained within an AIP ** must** be beneficial to one or more
34+ types of clients or their authors, including but not limited to:
35+
36+ - Asset inventories which can be used to audit and analyze resources.
37+ - Command line interfaces for exploration and simple automation.
38+ - Custom controllers (e.g. auto-scalers) which poll live state and adjust
39+ resource configruation accordingly.
40+ - [ IaC] [ ] clients for orchestration and automation of multiple resources.
41+ - Recommendation tools which provide guidance on which APIs are useful for
42+ specific use cases, and how to use them.
43+ - SDKs to interact with an API from a programming language, often used heavily
44+ for data-plane operations.
45+ - Security orchestration, automation, and remediation tools.
46+ - Simple scripts to automate or orchestrate tasks.
47+ - Test frameworks.
48+ - Tools that operate on resource data at rest.
49+ - Visual User Interfaces for visualization and one-off manual actions.
50+ - Users.
51+
52+ Examples of improvements include:
53+
54+ - Requiring new proto annotations that enable more descriptive interfaces on
55+ clients (e.g. requiring ` singular ` and ` plural ` on a ` google.api.resource `
56+ annotation).
57+
58+ AIP guidance ** must not** be a significant detriment to a client's usability or
59+ implementation difficulty, or maintenance difficulty.
60+
61+ Examples of detriments include:
62+
63+ - Introduction of a non-uniform pattern in a standard method such that all
64+ clients must introduce additional code without sufficient benefit (e.g. List
65+ behaves like this * except* for resources that start with the name Foo).
66+ - Renames of well-established fields for minor improvements in readability (e.g.
67+ rename ` expire_time ` to ` lapse_time ` since ` lapse ` is a common term in my
68+ service).
2669
2770While the length of AIPs will necessarily vary based on the complexity of the
2871question, most AIPs ** should** be able to cover their content in roughly two
@@ -190,12 +233,27 @@ subdirectory); this ensures that the link works both on the AIP site, when
190233viewing the Markdown file on GitHub, using the local development server, or a
191234branch.
192235
236+ ## Rationale
237+
238+ ### Designing for a broad set of clients
239+
240+ API guidance, similar to any software, is most beneficial when there is a clear
241+ purpose and target beneficiary.
242+
243+ The beneficiaries of improved API design are users. These users interact with
244+ APIs via a variety of clients, depending on their use case as enumerated above.
245+
246+ API guidance must in turn consider the impact broadly across these clients.
247+
193248[ aip-1 ] : ./0001.md
249+ [ Infrastructure as Code ] : ./0009.md#iac
250+ [ IaC ] : ./0009.md#iac
194251[ protocol buffers ] : https://developers.google.com/protocol-buffers/
195252[ rfc 2119 ] : https://www.ietf.org/rfc/rfc2119.txt
196253
197254## Changelog
198255
256+ - ** 2023-05-20** : Increase API guidance scope to include broad set of clients.
199257- ** 2023-03-30** : Removed appendix, added rationale and history to the template.
200258- ** 2020-02-18** : Specified reverse chronological ordering for changelog items.
201259- ** 2019-08-23** : Added guidance for internal AIP links.
0 commit comments