diff --git a/README.md b/README.md index 27f1cca4..19a144d3 100644 --- a/README.md +++ b/README.md @@ -788,6 +788,7 @@ Their compliance with the [GraphQL over HTTP spec](https://graphql.github.io/gra | [graphql-helix](https://www.graphql-helix.com) | [✅ Compliant](/implementations/graphql-helix/README.md) | | [graphql-yoga](https://www.the-guild.dev/graphql/yoga-server) | [✅ Compliant](/implementations/graphql-yoga/README.md) | | [hotchocolate](https://chillicream.com/docs/hotchocolate) | [✅ Compliant](/implementations/hotchocolate/README.md) | +| [lighthouse](https://lighthouse-php.com) | [✅ Compliant](/implementations/lighthouse/README.md) | | [pioneer](https://pioneer.dexclaimation.com) | [✅ Compliant](/implementations/pioneer/README.md) | | [postgraphile](https://www.graphile.org/postgraphile) | [✅ Compliant](/implementations/postgraphile/README.md) | diff --git a/implementations/lighthouse/Dockerfile b/implementations/lighthouse/Dockerfile new file mode 100644 index 00000000..7a1f563f --- /dev/null +++ b/implementations/lighthouse/Dockerfile @@ -0,0 +1,17 @@ +FROM php:8.1-cli + +WORKDIR /app + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +RUN apt-get update && \ + apt-get install --yes \ + git \ + libzip-dev \ + zip \ + && docker-php-ext-install \ + zip \ + && rm -rf /var/lib/apt/lists/* +RUN composer create-project laravel/laravel /app +RUN composer require nuwave/lighthouse +RUN php artisan vendor:publish --tag=lighthouse-schema diff --git a/implementations/lighthouse/README.md b/implementations/lighthouse/README.md new file mode 100644 index 00000000..ab59b418 --- /dev/null +++ b/implementations/lighthouse/README.md @@ -0,0 +1,282 @@ +* This report was auto-generated by graphql-http + +

GraphQL over HTTP audit report

+ + + +

Passing

+
    +
  1. 4655 MUST accept application/json and match the content-type
  2. +
  3. 47DE SHOULD accept */* and use application/json for the content-type
  4. +
  5. 80D8 SHOULD assume application/json content-type when accept is missing
  6. +
  7. 82A3 MUST use utf-8 encoding when responding
  8. +
  9. BF61 MUST accept utf-8 encoded request
  10. +
  11. 78D5 MUST assume utf-8 in request if encoding is unspecified
  12. +
  13. 2C94 MUST accept POST requests
  14. +
  15. 5A70 MAY accept application/x-www-form-urlencoded formatted GET requests
  16. +
  17. 03D4 MUST accept application/json POST requests
  18. +
  19. 34A2 SHOULD allow string {query} parameter when accepting application/graphql-response+json
  20. +
  21. 13EE MUST allow string {query} parameter when accepting application/json
  22. +
  23. 8161 SHOULD allow string {operationName} parameter when accepting application/graphql-response+json
  24. +
  25. B8B3 MUST allow string {operationName} parameter when accepting application/json
  26. +
  27. 94B0 SHOULD allow null {variables} parameter when accepting application/graphql-response+json
  28. +
  29. 0220 MUST allow null {variables} parameter when accepting application/json
  30. +
  31. 94B1 SHOULD allow null {operationName} parameter when accepting application/graphql-response+json
  32. +
  33. 0221 MUST allow null {operationName} parameter when accepting application/json
  34. +
  35. 94B2 SHOULD allow null {extensions} parameter when accepting application/graphql-response+json
  36. +
  37. 0222 MUST allow null {extensions} parameter when accepting application/json
  38. +
  39. 2EA1 SHOULD allow map {variables} parameter when accepting application/graphql-response+json
  40. +
  41. 28B9 MUST allow map {variables} parameter when accepting application/json
  42. +
  43. D6D5 MAY allow URL-encoded JSON string {variables} parameter in GETs when accepting application/graphql-response+json
  44. +
  45. 6A70 MAY allow URL-encoded JSON string {variables} parameter in GETs when accepting application/json
  46. +
  47. 428F SHOULD allow map {extensions} parameter when accepting application/graphql-response+json
  48. +
  49. 1B7A MUST allow map {extensions} parameter when accepting application/json
  50. +
  51. 572B SHOULD use 200 status code on document parsing failure when accepting application/json
  52. +
  53. FDE2 SHOULD use 200 status code on document validation failure when accepting application/json
  54. +
  55. 7B9B SHOULD use a status code of 200 on variable coercion failure when accepting application/json
  56. +
  57. D586 SHOULD not contain the data entry on document parsing failure when accepting application/graphql-response+json
  58. +
  59. 5E5B SHOULD not contain the data entry on document validation failure when accepting application/graphql-response+json
  60. +
+ +

Warnings

+The server SHOULD support these, but is not required. +
    +
  1. 22EB SHOULD accept application/graphql-response+json and match the content-type +
    +Response header content-type does not contain application/graphql-response+json +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "data": {
    +      "__typename": "Query"
    +    }
    +  }
    +}
    +
    +
    +
  2. +
  3. 9C48 MAY NOT allow executing mutations on GET requests +
    +Response status is not between 400 and 499 +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "errors": [
    +      {
    +        "message": "Schema is not configured for mutations.",
    +        "locations": [
    +          {
    +            "line": 1,
    +            "column": 1
    +          }
    +        ],
    +        "extensions": {
    +          "line": 350,
    +          "file": "/app/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php"
    +        }
    +      }
    +    ]
    +  }
    +}
    +
    +
    +
  4. +
  5. 865D SHOULD use 4xx or 5xx status codes on document parsing failure when accepting application/graphql-response+json +
    +Response status is not between 400 and 599 +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "errors": [
    +      {
    +        "message": "Syntax Error: Expected Name, found ",
    +        "locations": [
    +          {
    +            "line": 1,
    +            "column": 2
    +          }
    +        ],
    +        "extensions": {
    +          "line": 383,
    +          "file": "/app/vendor/webonyx/graphql-php/src/Language/Parser.php"
    +        }
    +      }
    +    ]
    +  }
    +}
    +
    +
    +
  6. +
  7. 556A SHOULD use 400 status code on document parsing failure when accepting application/graphql-response+json +
    +Response status code is not 400 +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "errors": [
    +      {
    +        "message": "Syntax Error: Expected Name, found ",
    +        "locations": [
    +          {
    +            "line": 1,
    +            "column": 2
    +          }
    +        ],
    +        "extensions": {
    +          "line": 383,
    +          "file": "/app/vendor/webonyx/graphql-php/src/Language/Parser.php"
    +        }
    +      }
    +    ]
    +  }
    +}
    +
    +
    +
  8. +
  9. 51FE SHOULD use 4xx or 5xx status codes on document validation failure when accepting application/graphql-response+json +
    +Response status is not between 400 and 599 +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "errors": [
    +      {
    +        "message": "Syntax Error: Expected Name, found Int \"8\"",
    +        "locations": [
    +          {
    +            "line": 1,
    +            "column": 3
    +          }
    +        ],
    +        "extensions": {
    +          "line": 383,
    +          "file": "/app/vendor/webonyx/graphql-php/src/Language/Parser.php"
    +        }
    +      }
    +    ]
    +  }
    +}
    +
    +
    +
  10. +
  11. 74FF SHOULD use 400 status code on document validation failure when accepting application/graphql-response+json +
    +Response status code is not 400 +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "errors": [
    +      {
    +        "message": "Syntax Error: Expected Name, found Int \"8\"",
    +        "locations": [
    +          {
    +            "line": 1,
    +            "column": 3
    +          }
    +        ],
    +        "extensions": {
    +          "line": 383,
    +          "file": "/app/vendor/webonyx/graphql-php/src/Language/Parser.php"
    +        }
    +      }
    +    ]
    +  }
    +}
    +
    +
    +
  12. +
  13. 86EE SHOULD use a status code of 400 on variable coercion failure when accepting application/graphql-response+json +
    +Response status code is not 400 +
    {
    +  "statusText": "OK",
    +  "status": 200,
    +  "headers": {
    +    "x-powered-by": "PHP/8.1.17",
    +    "host": "localhost:4000",
    +    "date": "",
    +    "content-type": "application/json",
    +    "connection": "close",
    +    "cache-control": "no-cache, private"
    +  },
    +  "body": {
    +    "errors": [
    +      {
    +        "message": "Variable \"$id\" is never used in operation \"CoerceFailure\".",
    +        "locations": [
    +          {
    +            "line": 1,
    +            "column": 21
    +          }
    +        ],
    +        "extensions": {
    +          "line": 41,
    +          "file": "/app/vendor/webonyx/graphql-php/src/Validator/Rules/NoUnusedVariables.php"
    +        }
    +      }
    +    ]
    +  }
    +}
    +
    +
    +
  14. +
+ diff --git a/implementations/lighthouse/docker-compose.yml b/implementations/lighthouse/docker-compose.yml new file mode 100644 index 00000000..7b586fa2 --- /dev/null +++ b/implementations/lighthouse/docker-compose.yml @@ -0,0 +1,12 @@ +services: + lighthouse: + build: . + environment: + - PORT=${PORT} + ports: + - ${PORT}:${PORT} + entrypoint: 'php artisan serve --host=0.0.0.0 --port=${PORT}' + healthcheck: + test: curl -f http://localhost:$$PORT/graphql?query=%7B__typename%7D || exit 1 + interval: 3s + timeout: 1s diff --git a/implementations/lighthouse/package.json b/implementations/lighthouse/package.json new file mode 100644 index 00000000..15b4a5b4 --- /dev/null +++ b/implementations/lighthouse/package.json @@ -0,0 +1,9 @@ +{ + "private": true, + "name": "lighthouse", + "url": "https://lighthouse-php.com", + "packageManager": "yarn@3.2.3", + "scripts": { + "start": "docker compose up" + } +} diff --git a/implementations/lighthouse/report.json b/implementations/lighthouse/report.json new file mode 100644 index 00000000..abad12fe --- /dev/null +++ b/implementations/lighthouse/report.json @@ -0,0 +1,6 @@ +{ + "total": 37, + "ok": 30, + "warn": 7, + "error": 0 +} diff --git a/yarn.lock b/yarn.lock index 05e70135..31d384c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9311,6 +9311,12 @@ __metadata: languageName: node linkType: hard +"lighthouse@workspace:implementations/lighthouse": + version: 0.0.0-use.local + resolution: "lighthouse@workspace:implementations/lighthouse" + languageName: unknown + linkType: soft + "lines-and-columns@npm:^1.1.6": version: 1.2.4 resolution: "lines-and-columns@npm:1.2.4"