Skip to content

Commit 269f53b

Browse files
author
tkrop
committed
feat: improve headers guideline (#769)
1 parent 65370ec commit 269f53b

17 files changed

+897
-354
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.project
22
.sass-cache/
33
output/
4+
includes/
45
.project
56
.idea
67
.metals

BUILD.adoc

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ to the `all`-target.
2727
**Note:** We have currently not tested the capability of `markdownlint` (or
2828
`make format`) to fix linter violations.
2929

30+
== Find next Rule ID
31+
32+
If you want to create a new rule, you need to define a new rule identifier. Use
33+
the following command to find the next unused rule identifier.
34+
35+
[source,bash]
36+
----
37+
make next-rule-id
38+
----
3039

3140
== Generate Custom CSS
3241

Makefile

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DIRMOUNTS := /documents
44
DIRCONTENTS := chapters
55
DIRSCRIPTS := scripts
66
DIRBUILDS := output
7+
DIRINCLUDES := includes
78
DIRWORK := $(shell pwd -P)
89

910
.PHONY: all clean install lint format pull assets rules html pdf epub force
@@ -12,7 +13,7 @@ DIRWORK := $(shell pwd -P)
1213

1314
all: clean html rules
1415
clean:
15-
rm -rf $(DIRBUILDS);
16+
rm -rf $(DIRBUILDS) $(DIRINCLUDES);
1617

1718
install: $(NVM_BIN)/markdownlint
1819
$(NVM_BIN)/markdownlint:
@@ -58,20 +59,23 @@ rules: check-rules
5859
$(DIRSCRIPTS)/generate-rules-json.sh | \
5960
jq -s '{rules: . | sort}' | tee $(DIRBUILDS)/rules >$(DIRBUILDS)/rules.json;
6061

61-
html: check assets pull
62+
$(DIRINCLUDES): models/headers-1.0.0.yaml $(DIRSCRIPTS)/generate-includes.sh
63+
mkdir -p $(DIRINCLUDES); $(DIRSCRIPTS)/generate-includes.sh "$(DIRINCLUDES)";
64+
65+
html: $(DIRINCLUDES) check assets pull
6266
docker run -v $(DIRWORK):$(DIRMOUNTS)/ ${DOCKER} asciidoctor \
6367
-D $(DIRMOUNTS)/$(DIRBUILDS) index.adoc;
6468

6569
# Not used any longer.
66-
pdf: check pull
70+
pdf: $(DIRINCLUDES) check pull
6771
docker run -v $(DIRWORK):$(DIRMOUNTS)/ ${DOCKER} asciidoctor-pdf -v \
6872
-a pdf-fontsdir=$(DIRMOUNTS)/resources/fonts \
6973
-a pdf-theme=$(DIRMOUNTS)/resources/themes/pdf-theme.yml \
7074
-D $(DIRMOUNTS)/$(DIRBUILDS) index.adoc;
7175
mv -f $(DIRBUILDS)/index.pdf $(DIRBUILDS)/zalando-guidelines.pdf;
7276

7377
# Not used any longer.
74-
epub: check pull
78+
epub: $(DIRINCLUDES) check pull
7579
docker run -v $(DIRWORK):$(DIRMOUNTS)/ ${DOCKER} asciidoctor-epub3 \
7680
-D $(DIRMOUNTS)/$(DIRBUILDS) index.adoc;
7781
mv -f $(DIRBUILDS)/index.epub $(DIRBUILDS)/zalando-guidelines.epub;

README.adoc

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
https://github.com/zalando/restful-api-guidelines/actions/[image:https://github.com/zalando/restful-api-guidelines/actions/workflows/build.yml/badge.svg[Build status]]
55
Latest published version:
66
http://zalando.github.io/restful-api-guidelines/[*HTML*],
7-
http://zalando.github.io/restful-api-guidelines/zalando-guidelines.pdf[*PDF*],
8-
http://zalando.github.io/restful-api-guidelines/zalando-guidelines.epub[*EPUB3*]
97

108
== Purpose
119

chapters/compatibility.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ and be explicit in what is supported:
8787
* Ignoring unknown input fields is actually not an option for {PUT}, since it
8888
becomes asymmetric with subsequent {GET} response and HTTP is clear about the
8989
{PUT} _replace_ semantics and default roundtrip expectations (see
90-
{RFC-7231}#section-4.3.4[RFC 7231 Section 4.3.4]). Note, accepting (i.e. not
90+
{RFC-9110}#section-9.3.4[RFC 9110 Section 9.3.4]). Note, accepting (i.e. not
9191
ignoring) unknown input fields and returning it in subsequent {GET} responses
9292
is a different situation and compliant to {PUT} semantics.
9393
* Certain client errors cannot be recognized by servers, e.g. attribute name
@@ -126,7 +126,7 @@ Service clients should apply the robustness principle:
126126
** Be prepared to handle HTTP status codes not explicitly specified in endpoint
127127
definitions. Note also, that status codes are extensible. Default handling is
128128
how you would treat the corresponding {x00} code (see
129-
{RFC-7231}#section-6[RFC 7231 Section 6]).
129+
{RFC-9110}#section-15[RFC 9110 Section 15]).
130130
** Follow the redirect when the server returns HTTP status code {301} (Moved
131131
Permanently).
132132

chapters/deprecation.adoc

+26-7
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ breaking effects on ongoing consumers. See also <<193>>.
6262

6363
During the deprecation phase, the producer should add a `Deprecation: <date-time>`
6464
(see https://tools.ietf.org/html/draft-ietf-httpapi-deprecation-header[draft: RFC
65-
Deprecation HTTP Header]) and - if also planned - a `Sunset: <date-time>` (see
66-
{RFC-8594}#section-3[RFC 8594]) header on each response affected by a
65+
Deprecation HTTP Header Field]) and - if also planned - a `Sunset: <date-time>`
66+
(see {RFC-8594}#section-3[RFC 8594]) header on each response affected by a
6767
deprecated element (see <<187>>).
6868

6969
The {Deprecation} header can either be set to `true` - if a feature is retired
@@ -81,17 +81,35 @@ Sunset: Wed, 31 Dec 2025 23:59:59 GMT
8181

8282
If multiple elements are deprecated the {Deprecation} and {Sunset} headers are
8383
expected to be set to the earliest time stamp to reflect the shortest interval
84-
consumers are expected to get active.
84+
at which consumers are expected to get active. The {Deprecation} and {Sunset}
85+
headers can be defined as follows in the API specification (see also the
86+
default definition below):
87+
88+
[source,yaml]
89+
----
90+
components:
91+
parameters|headers:
92+
Deprecation:
93+
$ref: 'https://opensource.zalando.com/restful-api-guidelines/models/headers-1.0.0.yaml#/Deprecation'
94+
Sunset:
95+
$ref: 'https://opensource.zalando.com/restful-api-guidelines/models/headers-1.0.0.yaml#/Sunset'
96+
----
97+
98+
[source,yaml]
99+
----
100+
include::../includes/deprecation.yaml[]
101+
include::../includes/sunset.yaml[lines=3..-1]
102+
----
85103

86104
*Note:* adding the {Deprecation} and {Sunset} header is not sufficient to gain
87105
client consent to shut down an API or feature.
88106

89-
*Hint:* In earlier guideline versions, we used the `Warning` header to provide
90-
the deprecation info to clients. However, `Warning` header has a less specific
107+
*Hint:* In earlier guideline versions, we used the {Warning} header to provide
108+
the deprecation info to clients. However, {Warning} header has a less specific
91109
semantics, will be obsolete with
92110
https://tools.ietf.org/html/draft-ietf-httpbis-cache-06[draft: RFC HTTP
93-
Caching], and our syntax was not compliant with {RFC-7234}#page-29[RFC 7234
94-
-- Warning header].
111+
Caching], and our syntax was not compliant with {RFC-9111}#section-5.5[RFC 9111
112+
Section 5.5 "Warning"].
95113

96114

97115
[#190]
@@ -105,6 +123,7 @@ ensure alignment with service owners on required migration task.
105123
*Hint:* In earlier guideline versions, we used the `Warning` header to provide
106124
the deprecation info (see hint in <<189>>).
107125

126+
108127
[#191]
109128
== {MUST} not start using deprecated APIs
110129

0 commit comments

Comments
 (0)