Skip to content

Conversation

@maximkrouk
Copy link
Contributor

I couldn't reproduce the behavior in tests, but responses may be encoded in the wrong order because JSONEncoder uses a Dictionary under the hood, but GraphQLJSONEncoder uses OrderedDictionary and always encodes GraphQLResult correctly.

Btw the implementation requires a bit higher version of GraphQL than was specified in Package.resolved

@alexsteinerde
Copy link
Owner

To encode a response with a different encoder, you can register one the same way you would register one with Vapor.
For incoming decoding, Graphiti 1.0.0 adds native support for custom decoders.
As mentioned in #15 the underlying Graphiti packages has support for custom encoders. So, in my opinion, writing an additional wrapper around isn't useful enough.
Do you think the same functionality could be achieved with the graphiti-1.0.0 branch instead?

@maximkrouk
Copy link
Contributor Author

Seems like it cannot be achieved with Graphiti, at least my implementation encodes GraphQLResult to a specific Vapor type. The problem is that currently, you can only override the encoder for a specific mediatype globally, I couldn't find another way to override it only for GQL routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants