Skip to content

Commit 2ee55c7

Browse files
authored
Upgrade to OpenAPI 3.1 (#850)
* Upgrade to OpenAPI 3.1 Resolves issue: #839 * Update meta-information.adoc * Update .zappr.yaml * Update general-guidelines.adoc according to Tronje's comments. * Update api-operation.adoc * Repair link
1 parent fbd8533 commit 2ee55c7

File tree

4 files changed

+45
-42
lines changed

4 files changed

+45
-42
lines changed

.zappr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
X-Zalando-Team: architecture
1+
X-Zalando-Team: jedi
22
X-Zalando-Type: doc
33
approvals:
44
groups:

chapters/api-operation.adoc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33

44

55
[#192]
6-
== {MUST} publish OpenAPI specification for non-component-internal APIs
6+
== {MUST} publish OpenAPI specification for APIs
77

88
All service applications must publish OpenAPI specifications of their external
9-
APIs. While this is optional for internal APIs, i.e. APIs marked with the
10-
*component-internal* <<219, API audience>> group, we still recommend to do so
11-
to profit from the API management infrastructure.
12-
13-
An API is published by copying its *OpenAPI specification* into the reserved
14-
*/zalando-apis* directory of the *deployment artifact* used to deploy the
15-
provisioning service. The directory must only contain *self-contained YAML*
16-
*files* that each describe one API (exception see <<234>>). We prefer this
17-
deployment artifact-based method over the past (now legacy)
18-
`.well-known/schema-discovery` service endpoint-based publishing process, that
19-
we only support for backward compatibility reasons.
20-
21-
Background: In our dynamic and complex service infrastructure, it is important
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.
11+
12+
As described in https://cloud.docs.zalando.net/howtos/api-publishing/[How to publish API Specifications (internal_link)],
13+
an API specification is published with the deployment of the implementing service
14+
by copying it to the reserved `/zalando-apis` directory. The directory must only
15+
contain _self-contained YAML files_ that each describe one API (exception see <<234>>).
16+
*Legacy hint:* We prefer this deployment artifact-based method over the old
17+
`.well-known/schema-discovery` service endpoint-based publishing process
18+
(which still is supported for backward compatibility).
19+
20+
*Motivation:* In our dynamic and complex service infrastructure, it is important
2221
to provide API client developers a central place with online access to the API
2322
specifications of all running applications. As a part of the infrastructure,
24-
the API publishing process is used to detect API specifications. The findings
25-
are published in the API Portal - the universal hub for all Zalando APIs.
23+
the API publishing process is used to detect API specifications and to make it
24+
discoverable via
25+
https://sunrise.zalando.net/apis?group=all[Sunrise (internal_link)] and the
26+
https://apis.zalando.net/[API Portal (internal_link)].
2627

27-
*Note:* To publish an API, it is still necessary to deploy the artifact
28-
successful, as we focus the discovery experience on APIs supported by running
29-
services.
28+
*Note:* APIs are discoverable only for recently running services. Hence, make sure
29+
to always publish the API Specification as part of the service artifact deployment.
3030

3131

3232
[#193]

chapters/general-guidelines.adoc

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,28 @@ You must follow the <<api-first, API First Principle>>, more specifically:
2424
[#101]
2525
== {MUST} provide API specification using OpenAPI
2626

27-
We use the http://swagger.io/specification/[OpenAPI specification] as standard
28-
to define API specification files. API designers are required to provide the API
29-
specification using a single *self-contained YAML* file to improve readability.
30-
We encourage to use *OpenAPI 3.0* version, but still support *OpenAPI 2.0*
31-
(a.k.a. Swagger 2).
32-
33-
The API specification files should be subject to version control using a source
34-
code management system - best together with the implementing sources.
35-
36-
You <<192, must / should publish>> the component <<219, external / internal>>
37-
API specification with the deployment of the implementing service, and, hence,
38-
make it discoverable for the group via our {api-portal}[API Portal (internal_link)].
39-
40-
*Hint:* A good way to explore *OpenAPI 3.0/2.0* is to navigate through the
41-
https://openapi-map.apihandyman.io/[OpenAPI specification mind map] and use
42-
our https://plugins.jetbrains.com/search?search=swagger+Monte[Swagger Plugin
43-
for IntelliJ IDEA] to create your first API. To explore and validate/evaluate
44-
existing APIs the https://editor.swagger.io/[Swagger Editor] or our
45-
https://apis.zalando.net[API Portal] may be a good starting point.
27+
We use the standard provided by the https://www.openapis.org/[OpenAPI Initiative]
28+
to define API specifications. API designers are required to provide the API
29+
specification using a single self-contained YAML file for better readability.
30+
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
32+
control using a source code management system, and you <<192>>.
33+
34+
*Hint:* Our API infrastructure does not break, but might not yet fully support
35+
all OpenAPI 3.1 changes (e.g. displaying `examples` in Sunrise), and continues
36+
supporting OpenAPI 3.0 (and 2.0, aka Swagger 2).
37+
38+
*Hint:* The _OpenAPI 3.1 mayor change_ is that Schema Object definitions are now
39+
fully compliant with standard JSON Schema. It is an incompatible change since
40+
OpenAPI-specific overrides and keywords like `example`, `nullable`, `discriminator`, `xml`
41+
are removed from the Schema Object (see
42+
https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0[OpenAPI Blog: Migrating from OpenAPI 3.0 to 3.1]).
43+
Check out the https://github.com/OAI/OpenAPI-Specification/releases[OpenAPI release page]
44+
for all change details.
45+
46+
*Hint:* You might find the https://openapi-map.apihandyman.io/[OpenAPI Map]
47+
a helpful tool supporting UI navigation for the OpenAPI 3.0 specification.
48+
(Newer OpenAPI versions are not yet supported.)
4649

4750
*Hint:* We do not yet provide guidelines for https://graphql.org/[GraphQL]
4851
and focus on resource oriented HTTP/REST API style (and related tooling

chapters/meta-information.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Example:
5050

5151
[source,yaml]
5252
----
53-
openapi: 3.0.1
53+
openapi: 3.1.0
5454
info:
5555
title: Parcel Service API
5656
description: API for <...>
@@ -97,7 +97,7 @@ Example:
9797

9898
[source,yaml]
9999
----
100-
openapi: 3.0.1
100+
openapi: 3.1.0
101101
info:
102102
x-api-id: d0184f38-b98d-11e7-9c56-68f728c1ba70
103103
title: Parcel Service API
@@ -170,7 +170,7 @@ Example:
170170

171171
[source,yaml]
172172
----
173-
openapi: 3.0.1
173+
openapi: 3.1.0
174174
info:
175175
x-audience: company-internal
176176
title: Parcel Helper Service API

0 commit comments

Comments
 (0)