Skip to content

Commit 95d1876

Browse files
handrewsMikeRalphson
authored andcommitted
Standardize on "Description" as discussed on Slack
The learn site previously decided to use OpenAPI Description, but hedged with terms like "OpenAPI Description document" and often reverted to "OpenAPI document" in the text. A recent discussion on Slack finally revealed a consensus that * Re-defining "document" away from its intuitive meaning as a single coherent thing (file or network resource) is confusing * "description" has more support than "definition" or "document" Following up on that discussion, this change standardizes on: * "OpenAPI Description" as the term for the logical entity * "OAD" as a standardized abbreviation, alongside OAS and OAI * "document" to mean either local file or network resource * "documentation" only refers to generated or hand-written docs
1 parent 353636a commit 95d1876

12 files changed

+79
-79
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<img alt="OpenAPI Initiative" src="assets/images/OpenAPI_Logo_Pantone-1.png" width="100%" height="auto">
44

5-
Are you new to the OpenAPI specification?
5+
Are you new to the OpenAPI Specification?
66

77
Read our [Getting started](https://learn.openapis.org/) page first.
88

best-practices.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ nav_order: 4
66

77
# Best Practices
88

9-
This page contains general pieces of advice which do not strictly belong to the [Specification Explained](specification) chapter because they are not directly tied to the OpenAPI Specification.
9+
This page contains general pieces of advice which do not strictly belong to the [Specification Explained](specification) chapter because they are not directly tied to the OpenAPI Specification (OAS).
1010

11-
However, they greatly simplify creating and maintaining OpenAPI documents, so they are worth keeping in mind.
11+
However, they greatly simplify creating and maintaining OpenAPI Descriptions (OADs), so they are worth keeping in mind.
1212

1313
## Use a Design-First Approach
1414

15-
Traditionally, two main approaches exist when creating OpenAPI documents: **Code-first** and **Design-first**.
15+
Traditionally, two main approaches exist when creating OADs: **Code-first** and **Design-first**.
1616

1717
- In the Code-first approach, **the API is first implemented in code**, and then its description is created from it, using code comments, code annotations or simply written from scratch. This approach does not require developers to learn another language so it is usually regarded as the easiest one.
1818

1919
- Conversely, in Design-first, **the API description is written first** and then the code follows. The first obvious advantages are that the code already has a skeleton upon which to build, and that some tools can provide boilerplate code automatically.
2020

21-
There have been a number of heated debates over the relative merits of these two approaches but, in the opinion of the OpenAPI Initiative, the importance of using **Design-first** cannot be stressed strongly enough.
21+
There have been a number of heated debates over the relative merits of these two approaches but, in the opinion of the OpenAPI Initiative (OAI), the importance of using **Design-first** cannot be stressed strongly enough.
2222

2323
The reason is simple: **The number of APIs that can be created in code is far superior to what can be described in OpenAPI**. To emphasize: **OpenAPI is not capable of describing every possible HTTP API, it has limitations**.
2424

2525
Therefore, unless these descriptive limitations are perfectly known and taken into account when coding the API, they will rear their ugly head later on when trying to create an OpenAPI description for it. At that point, the right fix will be to change the code so that it uses an API which can be actually described with OpenAPI (or switch to Design-first altogether).
2626

2727
Sometimes, however, since it is late in the process, it will be preferred to twist the API description so that it matches *more or less* the actual API. It goes without saying that this leads to **unintuitive and incomplete descriptions**, that will rarely scale in the future.
2828

29-
Finally, there exist a number of [validation tools](https://tools.openapis.org/categories/data-validators) that can verify that the implemented code adheres to the OpenAPI description. Running these tools as part of a Continuous Integration process allows changing the OpenAPI document with peace of mind, since deviations in the code behavior will be promptly detected.
29+
Finally, there exist a number of [validation tools](https://tools.openapis.org/categories/data-validators) that can verify that the implemented code adheres to the OpenAPI description. Running these tools as part of a Continuous Integration process allows changing the OpenAPI Description with peace of mind, since deviations in the code behavior will be promptly detected.
3030

3131
> **Bottom line:**
3232
> OpenAPI opens the door to a [wealth of automated tools](https://tools.openapis.org). Make sure you use them!
@@ -41,45 +41,45 @@ For instance, it is also commonplace to use code annotations to generate an Open
4141

4242
Alternatively, you can use a Continuous Integration test to ensure that the two sources stay consistent.
4343

44-
## Add OpenAPI Documents to Source Control
44+
## Add OpenAPI Descriptions to Source Control
4545

46-
OpenAPI descriptions are **not** just a documentation artifact: they are **first-class source files** which can drive a great number of automated processes, including boilerplate generation, unit testing and documentation rendering.
46+
OpenAPI Descriptions are **not** just a documentation artifact: they are **first-class source files** which can drive a great number of automated processes, including boilerplate generation, unit testing and documentation rendering.
4747

48-
As such, OpenAPI description should be committed to source control, and, in fact, they should be among the first files to be committed. From there, they should also participate in Continuous Integration processes.
48+
As such, OADs should be committed to source control, and, in fact, they should be among the first files to be committed. From there, they should also participate in Continuous Integration processes.
4949

50-
## Make the OpenAPI Documents Available to the Users
50+
## Make the OpenAPI Descriptions Available to the Users
5151

52-
Beautifully-rendered documents can be very useful for the users of an API, but sometimes they might want to access the source OpenAPI description. For instance, to use tools to generate client code for them, or to build automated bindings for some language.
52+
Beautifully-rendered documentation can be very useful for the users of an API, but sometimes they might want to access the source OAD. For instance, to use tools to generate client code for them, or to build automated bindings for some language.
5353

54-
Therefore, making the OpenAPI documents available to the users is an added bonus for them. The document can even be made available through the same API to allow runtime discovery.
54+
Therefore, making the OAD available to the users is an added bonus for them. The documents that make up the OAD can even be made available through the same API to allow runtime discovery.
5555

56-
## There is Seldom Need to Write OpenAPI Documents by Hand
56+
## There is Seldom Need to Write OpenAPI Descriptions by Hand
5757

58-
Since OpenAPI documents are plain text files, in an easy-to-read format (be it JSON or YAML), API designers are usually tempted to write them by hand.
58+
Since OADs are plain text documents, in an easy-to-read format (be it JSON or YAML), API designers are usually tempted to write them by hand.
5959

6060
While there is nothing stopping you from doing this, and, in fact, hand-written API descriptions are usually the most terse and efficient, approaching any big project by such method is highly impractical.
6161

6262
Instead, you should try the other existing creation methods and choose the one that better suits you and your team (No YAML or JSON knowledge needed!):
6363

6464
- **OpenAPI Editors**: Be it [text editors](https://tools.openapis.org/categories/text-editors) or [GUI editors](https://tools.openapis.org/categories/gui-editors) they usually take care of repetitive tasks, allow you to keep a library of reusable components and provide real-time preview of the generated documentation.
6565

66-
- **Domain-Specific Languages**: As its name indicates, [DSL](https://tools.openapis.org/categories/dsl)'s are API description languages tailored to specific development fields. A tool is then used to produce the OpenAPI document. A new language has to be learned, but, in return, extremely concise descriptions can be achieved.
66+
- **Domain-Specific Languages**: As its name indicates, [DSL](https://tools.openapis.org/categories/dsl)'s are API description languages tailored to specific development fields. A tool is then used to produce the OpenAPI Description. A new language has to be learned, but, in return, extremely concise descriptions can be achieved.
6767

68-
- **Code Annotations**: Most programming languages allow you to _annotate_ the code, be it with specific syntax or with general code comments. These annotations, for example, can be used to extend a method signature with information regarding the API endpoint and HTTP method that lead to it. A tool can then parse the code annotations and generate OpenAPI documents automatically. This method fits very nicely with the code-first approach, so keep in mind the first advice given at the top of this page when using it (Use a Design-First Approach)...
68+
- **Code Annotations**: Most programming languages allow you to _annotate_ the code, be it with specific syntax or with general code comments. These annotations, for example, can be used to extend a method signature with information regarding the API endpoint and HTTP method that lead to it. A tool can then parse the code annotations and generate OADs automatically. This method fits very nicely with the code-first approach, so keep in mind the first advice given at the top of this page when using it (Use a Design-First Approach)...
6969

70-
- **A Mix of All the Above**: It's perfectly possible to create the bulk of an OpenAPI document using an editor or DSL and then hand-tune the resulting file. Just be aware of the second advice above (Keep a Single Source of Truth): Once you modify a file **it becomes the source of truth** and the previous one should be discarded (maybe keep it as backup, but out of the sight and reach of children and newcomers to the project).
70+
- **A Mix of All the Above**: It's perfectly possible to create the bulk of an OpenAPI Description using an editor or DSL and then hand-tune the resulting file. Just be aware of the second advice above (Keep a Single Source of Truth): Once you modify a file **it becomes the source of truth** and the previous one should be discarded (maybe keep it as backup, but out of the sight and reach of children and newcomers to the project).
7171

72-
## Working with Big Documents
72+
## Describing Large APIs
7373

74-
This is a collection of small hints related to working with large API description documents.
74+
This is a collection of small hints related to working with large OADs.
7575

7676
- **Do not repeat yourself** (The DRY principle). If the same piece of YAML or JSON appears more than once in the document, it's time to move it to the `components` section and reference it from other places using `$ref` (See [Reusing Descriptions](specification/components). Not only will the resulting document be smaller but it will also be much easier to maintain).
7777

78-
Components can be referenced from other files, so you can even reuse them across different API documents!
78+
Components can be referenced from other documents, so you can even reuse them across different API descriptions!
7979

80-
- **Split the document into several files**: Smaller files are easier to navigate, but too many of them are equally taxing. The key lies somewhere in the middle.
80+
- **Split the description into several documents**: Smaller files are easier to navigate, but too many of them are equally taxing. The key lies somewhere in the middle.
8181

82-
A good rule of thumb is to use the natural hierarchy present in URLs to build your file structure. For example, put all routes starting with `/users` (like `/users` and `/users/{id}`) in the same file (think of it as a "sub-API").
82+
A good rule of thumb is to use the natural hierarchy present in URLs to build your directory structure. For example, put all routes starting with `/users` (like `/users` and `/users/{id}`) in the same file (think of it as a "sub-API").
8383

8484
Bear in mind that some tools might have issues with large files, whereas some other tools might not handle too many files gracefully. The solution will have to take your toolkit into account.
8585

index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ nav_order: 1
77
# Getting started
88
## Intended Audience
99

10-
This guide is directed at **HTTP-based API** designers and writers wishing to benefit from having their API formalized in an **OpenAPI Description document**.
10+
This guide is directed at **HTTP-based API** designers and writers wishing to benefit from having their API formalized in an **OpenAPI Description** (**OAD**).
1111

1212
Machine-readable API descriptions are ubiquitous nowadays and **OpenAPI** is **the most broadly adopted industry standard for describing new APIs**. It is therefore worth learning it and getting it right from the start.
1313

14-
These pages are a companion to the [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0), helping the reader learn it and answering questions like "What is the best way to accomplish... ?" or "What is the purpose of... ?" that are naturally out of the scope of the specification.
14+
These pages are a companion to the [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0) (OAS), helping the reader learn it and answering questions like "What is the best way to accomplish... ?" or "What is the purpose of... ?" that are naturally out of the scope of the specification.
1515

1616
- If you are unsure if this guide is for you, read the next section below.
1717
- If you do not know what "API", "machine-readable description" or "OpenAPI" mean start by reading the [Introduction](introduction) chapter.
18-
- If this is your first time writing an **OpenAPI Description document** read [The OpenAPI Specification explained](specification) chapter for step-by-step tutorials.
18+
- If this is your first time writing an **OpenAPI Description** read [The OpenAPI Specification explained](specification) chapter for step-by-step tutorials.
1919
- If you already have **OpenAPI** experience but need help with a specific topic, take a look at the index of [The OpenAPI Specification explained](specification) chapter; it also includes advanced topics.
2020
- Finally, make sure you are aware of the recommended [Best Practices](best-practices) to take full advantage of **OpenAPI**!
2121
- And of course, you can always refer to the actual [OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0) for reference.
@@ -36,6 +36,6 @@ On top of this, the **OpenAPI Specification** also provides you with:
3636

3737
- **A non-proprietary format**: You have a say in the future direction of the Specification!
3838
- **The most developed tooling ecosystem**: As a direct result of the previous statement, OpenAPI offers a vast number of tools to work with it. Just take a quick look at [OpenAPI Tooling](https://tools.openapis.org).
39-
- **A format readable by both machines and humans**: Even though writing **OpenAPI** documents by hand is not the most convenient way of doing it (See [Best Practices](best-practices)), they are plain text files which can be easily browsed in case something needs to be debugged.
39+
- **A format readable by both machines and humans**: Even though writing OADs by hand is not the most convenient way of doing it (See [Best Practices](best-practices)), they are plain text files which can be easily browsed in case something needs to be debugged.
4040

4141
So, choose your desired entry point from the list at the top of this page and start your journey!

0 commit comments

Comments
 (0)