Closed kgoggin closed 4 years ago
Yes, it looks like the (TypeScript) type for extensions is readonly extensions: { [key: string]: any } | undefined;
I'd probably stick pretty close to this since I can't guarantee what all servers provide. Maybe extensions: option(Js.Dict.t(Js.Json.t))
? I'll add this shortly.
Configuration would be really nice, but I went down the functor path and it was not a good tradeoff in my eyes, but I welcome anyone to come in and give it a go. It's made a bit more difficult than it might otherwise be because I mirror the Js package structure for ease of human maintenance/conversion.
Awesome, thanks! Yeah, I can see where it'd get difficult to handle the complexity of making that configurable, and I think that type definition you suggested works well.
Fixed in v1.0.0-beta.0
The GraphQL error type allows for an
extensions
field, which is an arbitrary key/value object. Apollo leverages this to provide an errorcode
: https://www.apollographql.com/docs/apollo-server/data/errors/#codes.I'm not entirely sure what the correct type should be here. Apollo provides some pre-defined errors in apollo-server, but you can extend the ApolloError class to define other errors specific to your domain (which I've done in the app I'm using this for). One option might be to allow for passing your own GraphQLError and/or
extensions
type in the config, which you could define to contain the specific errors your app needs to handle? Aside from that, at least providing theextensions
field which contains acode
field typed as a string would be something.