graphql-php icon indicating copy to clipboard operation
graphql-php copied to clipboard

Comply with graphql-over-http specification

Open spawnia opened this issue 1 year ago • 3 comments

It would be great if the standard server were compliant with the GraphQL-over-HTTP specification.

The test suite could be done in a way that is reusable by other servers: https://github.com/graphql/graphql-over-http/issues/57

spawnia avatar Jul 21 '22 19:07 spawnia

Hey @spawnia. Someone has mentioned before that we could just use graphql-http's test suite to test for graphql-over-http spec compliance. I've made a tiny branch to run those: https://github.com/webonyx/graphql-php/compare/master...oprypkhantc:graphql-php:graphql-over-http

Could you take a look to see if this is even remotely what you had in mind? It's messy, but enough to show the idea. The test suite is in JS, so I thought simply running a real HTTP server is our best bet here.

If this looks alright to you, I can clean it up, add GH actions and, of course, work on the spec compliance. I believe I have a good understanding of the spec, plus there are 60 tests (only 20 of which pass with the current implementation) that cover just about everything.

What do you think?

oprypkhantc avatar Aug 13 '23 20:08 oprypkhantc

Of course that can be moved out of graphql-php to graphql-http once the spec compliance is ready, merged and stable. They host tests for a lot of implementations already. Unit tests should be plenty to test against basic stuff.

oprypkhantc avatar Aug 13 '23 20:08 oprypkhantc

I have already attempted to add compliance automation for a GraphQL server implementation that sits on top of this library, see https://github.com/nuwave/lighthouse/pull/2359. I wanted to use Deno due to its leaner setup, but progress on it is currently blocked due to https://github.com/graphql/graphql-http/issues/65.

If you can implement something similar for this library, I am all for it. Your branch seems to be using Node, that is also fine with me.

spawnia avatar Aug 14 '23 13:08 spawnia