Skip to content

Commit b8bdc71

Browse files
feat(audits): Notices section for optional recommendations (#76)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8cd7dfb commit b8bdc71

File tree

33 files changed

+6517
-140
lines changed

33 files changed

+6517
-140
lines changed

docs/interfaces/audits_common.AuditFail.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ ___
5252

5353
### status
5454

55-
**status**: ``"warn"`` \| ``"error"``
55+
**status**: ``"notice"`` \| ``"warn"`` \| ``"error"``

docs/modules/handler.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,17 @@ Creates an appropriate GraphQL over HTTP response following the provided argumen
252252

253253
If the first argument is an `ExecutionResult`, the operation will be treated as "successful".
254254

255-
If the first argument is _any_ object without the `data` field, it will be treated as an error (as per the spec)
256-
and the response will be constructed with the help of `acceptedMediaType` complying with the GraphQL over HTTP spec.
255+
If the first argument is (an array of) `GraphQLError`, or an `ExecutionResult` without the `data` field, it will be treated
256+
the response will be constructed with the help of `acceptedMediaType` complying with the GraphQL over HTTP spec.
257+
258+
If the first argument is an `Error`, the operation will be treated as a bad request responding with `400: Bad Request` and the
259+
error will be present in the `ExecutionResult` style.
257260

258261
#### Parameters
259262

260263
| Name | Type |
261264
| :------ | :------ |
262-
| `resultOrErrors` | readonly `GraphQLError`[] \| `Readonly`<`ExecutionResult`<`ObjMap`<`unknown`\>, `ObjMap`<`unknown`\>\>\> \| `Readonly`<`GraphQLError`\> |
265+
| `resultOrErrors` | readonly `GraphQLError`[] \| `Readonly`<`ExecutionResult`<`ObjMap`<`unknown`\>, `ObjMap`<`unknown`\>\>\> \| `Readonly`<`GraphQLError`\> \| `Readonly`<`Error`\> |
263266
| `acceptedMediaType` | [`AcceptableMediaType`](handler.md#acceptablemediatype) |
264267

265268
#### Returns

implementations/apollo-server/README.md

+34-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<h1>GraphQL over HTTP audit report</h1>
44

55
<ul>
6-
<li><b>37</b> audits in total</li>
7-
<li><span style="font-family: monospace">✅</span> <b>31</b> pass</li>
8-
<li><span style="font-family: monospace">⚠️</span> <b>6</b> warnings (optional)</li>
6+
<li><b>60</b> audits in total</li>
7+
<li><span style="font-family: monospace">✅</span> <b>54</b> pass</li>
8+
<li><span style="font-family: monospace">💡</span> <b>3</b> notices (suggestions)</li>
9+
<li><span style="font-family: monospace">⚠️</span> <b>3</b> warnings (optional)</li>
910
</ul>
1011

1112
<h2>Passing</h2>
@@ -19,9 +20,20 @@
1920
<li><code>78D5</code> MUST assume utf-8 in request if encoding is unspecified</li>
2021
<li><code>2C94</code> MUST accept POST requests</li>
2122
<li><code>9C48</code> MAY NOT allow executing mutations on GET requests</li>
23+
<li><code>9ABE</code> MAY respond with 4xx status code if content-type is not supplied on POST requests</li>
2224
<li><code>03D4</code> MUST accept application/json POST requests</li>
25+
<li><code>A5BF</code> MAY use 400 status code when request body is missing on POST</li>
26+
<li><code>423L</code> MAY use 400 status code on missing {query} parameter</li>
27+
<li><code>LKJ0</code> MAY use 400 status code on object {query} parameter</li>
28+
<li><code>LKJ1</code> MAY use 400 status code on number {query} parameter</li>
29+
<li><code>LKJ2</code> MAY use 400 status code on boolean {query} parameter</li>
30+
<li><code>LKJ3</code> MAY use 400 status code on array {query} parameter</li>
2331
<li><code>34A2</code> SHOULD allow string {query} parameter when accepting application/graphql-response+json</li>
2432
<li><code>13EE</code> MUST allow string {query} parameter when accepting application/json</li>
33+
<li><code>6C00</code> MAY use 400 status code on object {operationName} parameter</li>
34+
<li><code>6C01</code> MAY use 400 status code on number {operationName} parameter</li>
35+
<li><code>6C02</code> MAY use 400 status code on boolean {operationName} parameter</li>
36+
<li><code>6C03</code> MAY use 400 status code on array {operationName} parameter</li>
2537
<li><code>8161</code> SHOULD allow string {operationName} parameter when accepting application/graphql-response+json</li>
2638
<li><code>B8B3</code> MUST allow string {operationName} parameter when accepting application/json</li>
2739
<li><code>94B0</code> SHOULD allow null {variables} parameter when accepting application/graphql-response+json</li>
@@ -30,10 +42,22 @@
3042
<li><code>0221</code> MUST allow null {operationName} parameter when accepting application/json</li>
3143
<li><code>94B2</code> SHOULD allow null {extensions} parameter when accepting application/graphql-response+json</li>
3244
<li><code>0222</code> MUST allow null {extensions} parameter when accepting application/json</li>
45+
<li><code>4760</code> MAY use 400 status code on string {variables} parameter</li>
46+
<li><code>4761</code> MAY use 400 status code on number {variables} parameter</li>
47+
<li><code>4762</code> MAY use 400 status code on boolean {variables} parameter</li>
48+
<li><code>4763</code> MAY use 400 status code on array {variables} parameter</li>
3349
<li><code>2EA1</code> SHOULD allow map {variables} parameter when accepting application/graphql-response+json</li>
3450
<li><code>28B9</code> MUST allow map {variables} parameter when accepting application/json</li>
51+
<li><code>58B0</code> MAY use 400 status code on string {extensions} parameter</li>
52+
<li><code>58B1</code> MAY use 400 status code on number {extensions} parameter</li>
53+
<li><code>58B2</code> MAY use 400 status code on boolean {extensions} parameter</li>
54+
<li><code>58B3</code> MAY use 400 status code on array {extensions} parameter</li>
3555
<li><code>428F</code> SHOULD allow map {extensions} parameter when accepting application/graphql-response+json</li>
3656
<li><code>1B7A</code> MUST allow map {extensions} parameter when accepting application/json</li>
57+
<li><code>B6DC</code> MAY use 4xx or 5xx status codes on JSON parsing failure</li>
58+
<li><code>BCF8</code> MAY use 400 status code on JSON parsing failure</li>
59+
<li><code>8764</code> MAY use 4xx or 5xx status codes if parameters are invalid</li>
60+
<li><code>3E3A</code> MAY use 400 status code if parameters are invalid</li>
3761
<li><code>865D</code> SHOULD use 4xx or 5xx status codes on document parsing failure when accepting application/graphql-response+json</li>
3862
<li><code>556A</code> SHOULD use 400 status code on document parsing failure when accepting application/graphql-response+json</li>
3963
<li><code>D586</code> SHOULD not contain the data entry on document parsing failure when accepting application/graphql-response+json</li>
@@ -43,8 +67,8 @@
4367
<li><code>86EE</code> SHOULD use a status code of 400 on variable coercion failure when accepting application/graphql-response+json</li>
4468
</ol>
4569

46-
<h2>Warnings</h2>
47-
The server <i>SHOULD</i> support these, but is not required.
70+
<h2>Notices</h2>
71+
The server <i>MAY</i> support these, but are truly optional. These are suggestions following recommended conventions.
4872
<ol>
4973
<li><code>5A70</code> MAY accept application/x-www-form-urlencoded formatted GET requests
5074
<details>
@@ -160,6 +184,11 @@ The server <i>SHOULD</i> support these, but is not required.
160184
</code></pre>
161185
</details>
162186
</li>
187+
</ol>
188+
189+
<h2>Warnings</h2>
190+
The server <i>SHOULD</i> support these, but is not required.
191+
<ol>
163192
<li><code>572B</code> SHOULD use 200 status code on document parsing failure when accepting application/json
164193
<details>
165194
<summary>Response status code is not 200</summary>
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"total": 37,
3-
"ok": 31,
4-
"warn": 6,
2+
"total": 60,
3+
"ok": 54,
4+
"notice": 3,
5+
"warn": 3,
56
"error": 0
67
}

0 commit comments

Comments
 (0)