Skip to content

Commit 24fa5f7

Browse files
tfrauensteinThomas FrauensteinePaul
authored
Clarity about Versions of API Specifications (#853)
* Version of API Specification vs. OpenAPI Spec * Update general-guidelines.adoc * Update terms.adoc * Update terms.adoc * Update chapters/terms.adoc Co-authored-by: Paŭlo Ebermann <paul.ebermann@zalando.de> * Update chapters/terms.adoc Co-authored-by: Paŭlo Ebermann <paul.ebermann@zalando.de> * Update meta-information.adoc * Update chapters/terms.adoc Co-authored-by: Paŭlo Ebermann <paul.ebermann@zalando.de> --------- Co-authored-by: Thomas Frauenstein <thomas@zalando.de> Co-authored-by: Paŭlo Ebermann <paul.ebermann@zalando.de>
1 parent 25882ae commit 24fa5f7

12 files changed

+52
-36
lines changed

chapters/api-operation.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
[#192]
66
== {MUST} publish OpenAPI specification for APIs
77

8-
All service applications must publish OpenAPI specifications of their external
9-
APIs. While this is optional for <<219, component-internal APIs>>, we still
10-
recommend to do so to profit from our API management infrastructure.
8+
All service applications must publish API Specifications of their external
9+
APIs (see <<219, API Audience definition>>). While this is optional
10+
for <<219, component-internal>> APIs, we recommend doing so to profit from
11+
our API management infrastructure and review services.
1112

1213
As described in https://cloud.docs.zalando.net/howtos/api-publishing/[How to publish API Specifications (internal_link)],
1314
an API specification is published with the deployment of the implementing service

chapters/compatibility.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ if no API consumer is using the affected API aspects (see also <<deprecation,
3131
Deprecation>> guidelines).
3232

3333
*Hint:* Please note that the compatibility guarantees are for the "on the wire"
34-
format. Binary or source compatibility of code generated from an API definition
34+
format. Binary or source compatibility of code generated from an API specification
3535
is not covered by these rules. If client implementations update their
36-
generation process to a new version of the API definition, it has to be
36+
generation process to a new version of the API specification, it has to be
3737
expected that code changes are necessary.
3838

3939

@@ -56,7 +56,7 @@ services in a backward-compatible way:
5656
not be prepared to handle it. However, enum ranges can be extended when used
5757
for input parameters.
5858
* You <<112>> that are used for output parameters and likely to
59-
be extended with growing functionality. The API definition should be updated
59+
be extended with growing functionality. The API specification should be updated
6060
first before returning new values.
6161
* Consider <<251>> in case a URL has to change.
6262

@@ -103,8 +103,8 @@ and be explicit in what is supported:
103103
that already use this field but with different type.
104104

105105
In specific situations, where a (known) input field is not needed anymore, it
106-
either can stay in the API definition with "not used anymore" description or
107-
can be removed from the API definition as long as the server ignores this
106+
either can stay in the API specification with "not used anymore" description or
107+
can be removed from the API specification as long as the server ignores this
108108
specific parameter.
109109

110110

@@ -329,6 +329,6 @@ must implement a fallback / default behavior to handle unknown new enum values -
329329
API owners must take care to extend enums in a compatible way that does not change the
330330
semantics of already existing enum values, for instance, do not split an old enum value
331331
into two new enum values. Services should only extend {x-extensible-enum} ranges, and only accept
332-
and return values listed in the API definition, i.e. the API definition needs to be updated first
332+
and return values listed in the API specification, i.e. the API specification needs to be updated first
333333
before the service accepts/returns new values -- see also <<107>>.
334334

chapters/design-principles.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ implementation aspects — APIs should be stable even if we replace
118118
complete service implementation including its underlying technology
119119
stack
120120

121-
Moreover, API definitions with standardized specification format also
122-
facilitate...
121+
Moreover, API specifications using a standard format facilitate...
123122

124123
* single source of truth for the API specification; it is a crucial part
125124
of a contract between service provider and client users
@@ -147,7 +146,7 @@ and can never produce code before you have defined the complete API and
147146
get it confirmed by peer review.
148147

149148
On the other hand, API First obviously is in conflict with the bad
150-
practice of publishing API definition and asking for peer review after
149+
practice of publishing API specifications and asking for peer review after
151150
the service integration or even the service productive operation has
152151
started. It is crucial to request and get early feedback — as early as
153152
possible, but not before the API changes are comprehensive with focus

chapters/events.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ on the use of `additionalProperties`.
420420
[#246]
421421
== {MUST} use semantic versioning of event type schemas
422422

423-
Event schemas must be versioned -- analog to <<116>> for REST API definitions.
423+
Event schemas must be versioned -- analog to <<116>> for REST API specifications.
424424
The compatibility mode interact with revision numbers in the schema
425425
`version` field, which follows semantic versioning (MAJOR.MINOR.PATCH):
426426

chapters/general-guidelines.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[[general-guidelines]]
22
= General guidelines
33

4-
The titles are marked with the corresponding labels: {MUST},
5-
{SHOULD}, {MAY}.
4+
The titles are marked with the corresponding labels: {MUST}, {SHOULD}, {MAY}.
65

76

87
[#100]
@@ -22,13 +21,13 @@ You must follow the <<api-first, API First Principle>>, more specifically:
2221

2322

2423
[#101]
25-
== {MUST} provide API specification using OpenAPI
24+
== {MUST} provide API Specifications using OpenAPI
2625

2726
We use the standard provided by the https://www.openapis.org/[OpenAPI Initiative]
2827
to define API specifications. API designers are required to provide the API
2928
specification using a single self-contained YAML file for better readability.
3029
We encourage using https://swagger.io/specification/[OpenAPI 3.1 version],
31-
especially for new APIs. The API specification files should be subject to version
30+
especially for new APIs. The API specification documents should be subject to version
3231
control using a source code management system, and you <<192>>.
3332

3433
*Hint:* Our API infrastructure does not break, but might not yet fully support

chapters/introduction.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ external business partners to use via third-party applications.
1414

1515
With this in mind, we’ve adopted "API First" as one of our key
1616
engineering principles. Microservices development begins with API
17-
definition outside the code and ideally involves ample peer-review
17+
specification outside the code and ideally involves ample peer-review
1818
feedback to achieve high-quality APIs. API First encompasses a set of
1919
quality-related standards and fosters a peer review culture including a
2020
lightweight review procedure. We encourage our teams to follow them to

chapters/json-guidelines.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ the upper-snake case format, e.g. `VALUE` or `YET_ANOTHER_VALUE`.
141141
This approach allows to clearly distinguish values from properties or other elements.
142142

143143
**Exception:** This rule does not apply for case sensitive values sourced from outside
144-
API definition scope, e.g. for language codes from {ISO-639-1}[ISO 639-1], or when
144+
API specification scope, e.g. for language codes from {ISO-639-1}[ISO 639-1], or when
145145
declaring possible values for a <<137,rule 137>> [`sort` parameter].
146146

147147

chapters/meta-information.adoc

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
[#218]
66
== {MUST} contain API meta information
7-
API specifications must contain the following OpenAPI meta information
8-
to allow for API management:
7+
API specifications must contain the following
8+
https://spec.openapis.org/oas/latest.html#info-object[OpenAPI meta information]:
99

10-
- `#/info/title` as (unique) identifying, functional descriptive name of the API
11-
- `#/info/version` to distinguish API specifications versions following
12-
<<116, semantic rules>>
13-
- `#/info/description` containing a proper description of the API
14-
- `#/info/contact/{name,url,email}` containing the responsible team
10+
- `#/info/title` a (unique) identifying, functional descriptive name of the API
11+
- `#/info/version` the API specification document version following <<116>>
12+
- `#/info/description` a proper description of the API
13+
- `#/info/contact/{name,url,email}` contact info of the team owning the API specification
1514

16-
Following OpenAPI extension properties *must* be provided in addition:
15+
The following OpenAPI extension properties *must* be additionally provided:
1716

1817
- `#/info/x-api-id` unique identifier of the API (<<215, see rule 215>>)
1918
- `#/info/x-audience` intended target audience of the API (<<219, see rule 219>>)
@@ -22,11 +21,14 @@ Following OpenAPI extension properties *must* be provided in addition:
2221
[#116]
2322
== {MUST} use semantic versioning
2423

25-
OpenAPI allows to specify the API specification version in
26-
`#/info/version`. To share a common semantic of version information we
27-
expect API designers to comply to http://semver.org/spec/v2.0.0.html[
28-
Semantic Versioning 2.0] rules `1` to `8` and `11` restricted to the format
29-
<MAJOR>.<MINOR>.<PATCH> for versions as follows:
24+
OpenAPI requires the definition of API specification version via `#/info/version`.
25+
Note, this API specification document version is distinct from the
26+
OpenAPI Specification version (also required, e.g. `openapi: 3.1.0`),
27+
or the API Implementation version -- see <<terminology>>.
28+
29+
We expect API designers to comply to http://semver.org/spec/v2.0.0.html[
30+
Semantic Versioning 2.0] rules `1 - 8` and `11` with the standard version format
31+
<MAJOR>.<MINOR>.<PATCH> as follows:
3032

3133
* Increment the **MAJOR** version when you make incompatible API changes
3234
after having aligned the changes with consumers,
@@ -52,9 +54,9 @@ Example:
5254
----
5355
openapi: 3.1.0
5456
info:
57+
version: 1.3.7
5558
title: Parcel Service API
5659
description: API for <...>
57-
version: 1.3.7
5860
<...>
5961
----
6062

chapters/security.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
== {MUST} secure endpoints
77

88
Every API endpoint must be protected and armed with authentication and authorization.
9-
As part of the API definition you must specify how you protect your API using
9+
As part of the API specification you must define how you protect your API using
1010
either the `http` typed `bearer` or `oauth2` typed security schemes defined in the
1111
https://swagger.io/docs/specification/authentication/[OpenAPI Authentication Specification].
1212

chapters/terms.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[terminology]]
2+
= Basic Terminology
3+
4+
In the context of our REST API Guidelines, we differentiate the following entity types:
5+
6+
* **OpenAPI Specification** (OAS) -- the REST API specification format defined as standard by the https://www.openapis.org/[OpenAPI Initiative]. We currently encourage using https://spec.openapis.org/oas/v3.1.0.html[OpenAPI 3.1 version] for API specifications.
7+
* **API Specification** (aka https://spec.openapis.org/oas/latest.html#openapi-description-structure[OpenAPI Description (OAD)] -- the document in OAS format specifying an API, its syntax and semantics. It should provide all information for clients to use the API, and serves as the interface definition of the API implementation.
8+
* **API** -- the REST API interface provided via "the wire" (HTTP+TCP/IP) by a concrete service that is deployed and running.
9+
* **API Implementation** -- the implementation of the API as part of a concrete service implementation. It is typically code written in a programming language like Java or Python, and there can be multiple concrete implementations for the same API.
10+
11+
The API Specification, of course, might differ from the actual API provided by a concrete service, because e.g. the service implementation is incomplete, not up-to-date or faulty. The API Specification that is intended to be implemented by the service <<192, must / should be published with the service deployment>>.
12+
13+
Note, OpenAPI allows API Specifications being composed of an entry document and URL-referenced OpenAPI Documents defining path, component or webhook elements. However, we require to provide the API specification using a single self-contained YAML document for better readability and consistent versioning and life-cycle handling -- see <<101>>.

0 commit comments

Comments
 (0)