Skip to content

Commit aa29f4c

Browse files
enisdenjomichaelstaibgithub-actions[bot]
authored
chore: audit Hot Chocolate (#15)
Co-authored-by: Michael Staib <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 0c2ec6e commit aa29f4c

File tree

8 files changed

+173
-0
lines changed

8 files changed

+173
-0
lines changed

.github/workflows/audits.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,34 @@ jobs:
197197
name: thegraph-report
198198
path: README.md
199199

200+
hotchocolate:
201+
runs-on: ubuntu-latest
202+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
203+
env:
204+
PORT: 4000
205+
steps:
206+
- name: Checkout
207+
uses: actions/checkout@v3
208+
- name: Set up node
209+
uses: actions/setup-node@v3
210+
with:
211+
node-version: 18
212+
cache: yarn
213+
- name: Install
214+
run: yarn install --immutable
215+
- name: Build
216+
run: yarn build:esm
217+
- name: Start
218+
run: yarn workspace hotchocolate start -d --wait
219+
# TODO: cache docker build artifacts
220+
- name: Audit
221+
run: node scripts/audit-implementation.mjs README.md
222+
- name: Upload report
223+
uses: actions/upload-artifact@v3
224+
with:
225+
name: hotchocolate-report
226+
path: README.md
227+
200228
report:
201229
name: Report
202230
runs-on: ubuntu-latest
@@ -210,6 +238,7 @@ jobs:
210238
graphql-helix,
211239
graph-client,
212240
thegraph,
241+
hotchocolate,
213242
]
214243
steps:
215244
- name: Checkout
@@ -251,6 +280,11 @@ jobs:
251280
with:
252281
name: thegraph-report
253282
path: implementations/thegraph
283+
- name: Download hotchocolate report
284+
uses: actions/download-artifact@v3
285+
with:
286+
name: hotchocolate-report
287+
path: implementations/hotchocolate
254288
- name: Commit
255289
run: |
256290
git config user.name "github-actions[bot]"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ If you want a feature-full server with bleeding edge technologies, you're recomm
732732
| Name | Audit |
733733
| ------------------------------------------------------------------ | ------------------------------------------------------------------ |
734734
| [graphql-yoga](https://www.the-guild.dev/graphql/yoga-server) | [✅ Fully compliant](/implementations/graphql-yoga/README.md) |
735+
| [hotchocolate](https://chillicream.com/docs/hotchocolate) | [✅ Fully compliant](/implementations/hotchocolate/README.md) |
735736
| [mercurius](https://mercurius.dev) | [✅ Partially compliant](/implementations/mercurius/README.md) |
736737
| [graphql-helix](https://www.graphql-helix.com/) | [✅ Partially compliant](/implementations/graphql-helix/README.md) |
737738
| [apollo-server](https://www.apollographql.com/docs/apollo-server/) | [⚠️ Not compliant](/implementations/apollo-server/README.md) |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:7.0
2+
3+
WORKDIR /server
4+
5+
RUN dotnet new web
6+
RUN dotnet add package HotChocolate.AspNetCore --version 13.0.0-preview.80
7+
COPY Program.cs .
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
builder.Services
4+
.AddGraphQLServer()
5+
.AddQueryType<Query>()
6+
.AddMutationType<Mutation>();
7+
8+
var app = builder.Build();
9+
10+
app.MapGraphQL();
11+
12+
app.Run();
13+
14+
public class Query
15+
{
16+
public string Hello() => "world";
17+
}
18+
19+
public class Mutation
20+
{
21+
public string DontChange() => "ok";
22+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
_* This report was auto-generated by graphql-http_
2+
3+
# GraphQL over HTTP audit report
4+
5+
- **73** audits in total
6+
-**73** pass
7+
8+
## Passing
9+
1. SHOULD accept application/graphql-response+json and match the content-type
10+
2. MUST accept application/json and match the content-type
11+
3. SHOULD accept \*/\* and use application/graphql-response+json for the content-type
12+
4. SHOULD assume application/graphql-response+json content-type when accept is missing
13+
5. MUST use utf-8 encoding when responding
14+
6. MUST accept utf-8 encoding
15+
7. MUST assume utf-8 if encoding is unspecified
16+
8. MUST accept POST requests
17+
9. MAY accept application/x-www-form-urlencoded formatted GET requests
18+
10. MUST NOT allow executing mutations on GET requests
19+
11. SHOULD respond with 4xx status code if content-type is not supplied on POST requests
20+
12. MUST accept application/json POST requests
21+
13. MUST require a request body on POST
22+
14. SHOULD use 400 status code on missing {query} parameter when accepting application/graphql-response+json
23+
15. SHOULD use 200 status code with errors field on missing {query} parameter when accepting application/json
24+
16. SHOULD use 400 status code on object {query} parameter when accepting application/graphql-response+json
25+
17. SHOULD use 400 status code on number {query} parameter when accepting application/graphql-response+json
26+
18. SHOULD use 400 status code on boolean {query} parameter when accepting application/graphql-response+json
27+
19. SHOULD use 400 status code on array {query} parameter when accepting application/graphql-response+json
28+
20. SHOULD use 200 status code with errors field on object {query} parameter when accepting application/json
29+
21. SHOULD use 200 status code with errors field on number {query} parameter when accepting application/json
30+
22. SHOULD use 200 status code with errors field on boolean {query} parameter when accepting application/json
31+
23. SHOULD use 200 status code with errors field on array {query} parameter when accepting application/json
32+
24. SHOULD allow string {query} parameter when accepting application/graphql-response+json
33+
25. MUST allow string {query} parameter when accepting application/json
34+
26. SHOULD use 400 status code on object {operationName} parameter when accepting application/graphql-response+json
35+
27. SHOULD use 400 status code on number {operationName} parameter when accepting application/graphql-response+json
36+
28. SHOULD use 400 status code on boolean {operationName} parameter when accepting application/graphql-response+json
37+
29. SHOULD use 400 status code on array {operationName} parameter when accepting application/graphql-response+json
38+
30. SHOULD use 200 status code with errors field on object {operationName} parameter when accepting application/json
39+
31. SHOULD use 200 status code with errors field on number {operationName} parameter when accepting application/json
40+
32. SHOULD use 200 status code with errors field on boolean {operationName} parameter when accepting application/json
41+
33. SHOULD use 200 status code with errors field on array {operationName} parameter when accepting application/json
42+
34. SHOULD allow string {operationName} parameter when accepting application/graphql-response+json
43+
35. MUST allow string {operationName} parameter when accepting application/json
44+
36. SHOULD use 400 status code on string {variables} parameter when accepting application/graphql-response+json
45+
37. SHOULD use 400 status code on number {variables} parameter when accepting application/graphql-response+json
46+
38. SHOULD use 400 status code on boolean {variables} parameter when accepting application/graphql-response+json
47+
39. SHOULD use 400 status code on array {variables} parameter when accepting application/graphql-response+json
48+
40. SHOULD use 200 status code with errors field on string {variables} parameter when accepting application/json
49+
41. SHOULD use 200 status code with errors field on number {variables} parameter when accepting application/json
50+
42. SHOULD use 200 status code with errors field on boolean {variables} parameter when accepting application/json
51+
43. SHOULD use 200 status code with errors field on array {variables} parameter when accepting application/json
52+
44. SHOULD allow map {variables} parameter when accepting application/graphql-response+json
53+
45. MUST allow map {variables} parameter when accepting application/json
54+
46. SHOULD allow URL-encoded JSON string {variables} parameter in GETs when accepting application/graphql-response+json
55+
47. MUST allow URL-encoded JSON string {variables} parameter in GETs when accepting application/json
56+
48. SHOULD use 400 status code on string {extensions} parameter when accepting application/graphql-response+json
57+
49. SHOULD use 400 status code on number {extensions} parameter when accepting application/graphql-response+json
58+
50. SHOULD use 400 status code on boolean {extensions} parameter when accepting application/graphql-response+json
59+
51. SHOULD use 400 status code on array {extensions} parameter when accepting application/graphql-response+json
60+
52. SHOULD use 200 status code with errors field on string {extensions} parameter when accepting application/json
61+
53. SHOULD use 200 status code with errors field on number {extensions} parameter when accepting application/json
62+
54. SHOULD use 200 status code with errors field on boolean {extensions} parameter when accepting application/json
63+
55. SHOULD use 200 status code with errors field on array {extensions} parameter when accepting application/json
64+
56. SHOULD allow map {extensions} parameter when accepting application/graphql-response+json
65+
57. MUST allow map {extensions} parameter when accepting application/json
66+
58. SHOULD use 200 status code on JSON parsing failure when accepting application/json
67+
59. SHOULD use 200 status code if parameters are invalid when accepting application/json
68+
60. SHOULD use 200 status code on document parsing failure when accepting application/json
69+
61. SHOULD use 200 status code on document validation failure when accepting application/json
70+
62. SHOULD use 4xx or 5xx status codes on JSON parsing failure when accepting application/graphql-response+json
71+
63. SHOULD use 400 status code on JSON parsing failure when accepting application/graphql-response+json
72+
64. SHOULD not contain the data entry on JSON parsing failure when accepting application/graphql-response+json
73+
65. SHOULD use 4xx or 5xx status codes if parameters are invalid when accepting application/graphql-response+json
74+
66. SHOULD use 400 status code if parameters are invalid when accepting application/graphql-response+json
75+
67. SHOULD not contain the data entry if parameters are invalid when accepting application/graphql-response+json
76+
68. SHOULD use 4xx or 5xx status codes on document parsing failure when accepting application/graphql-response+json
77+
69. SHOULD use 400 status code on document parsing failure when accepting application/graphql-response+json
78+
70. SHOULD not contain the data entry on document parsing failure when accepting application/graphql-response+json
79+
71. SHOULD use 4xx or 5xx status codes on document validation failure when accepting application/graphql-response+json
80+
72. SHOULD use 400 status code on document validation failure when accepting application/graphql-response+json
81+
73. SHOULD not contain the data entry on document validation failure when accepting application/graphql-response+json
82+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
server:
3+
build: .
4+
environment:
5+
- DOTNET_URLS=http://+:${PORT}
6+
- PORT=${PORT}
7+
ports:
8+
- ${PORT}:${PORT}
9+
entrypoint: dotnet run
10+
healthcheck:
11+
test: curl -f http://localhost:$$PORT/graphql?query=%7B__typename%7D || exit 1
12+
interval: 3s
13+
timeout: 1s
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"private": true,
3+
"name": "hotchocolate",
4+
"packageManager": "[email protected]",
5+
"scripts": {
6+
"start": "docker compose up --build"
7+
}
8+
}

yarn.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7160,6 +7160,12 @@ __metadata:
71607160
languageName: node
71617161
linkType: hard
71627162

7163+
"hotchocolate@workspace:implementations/hotchocolate":
7164+
version: 0.0.0-use.local
7165+
resolution: "hotchocolate@workspace:implementations/hotchocolate"
7166+
languageName: unknown
7167+
linkType: soft
7168+
71637169
"html-escaper@npm:^2.0.0":
71647170
version: 2.0.2
71657171
resolution: "html-escaper@npm:2.0.2"

0 commit comments

Comments
 (0)