You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm considering using the extensions property to mark an object type as being a (Relay) connection, but it's not possible to set this property via the Field or FieldResolver decorators.
I want to do so, so that a resolver can use the GraphQLResolveInfo to determine whether or not an object is a connection, in order to apply special handling during the process of automatically generating a TypeORM query builder.
i.e. Adding extensions somewhere inside AdvancedOptions.
Describe alternatives you've considered
Using a GraphQL interface, and checking whether or not the type implements this interface.
I wasn't sure how to define the interface for Edge, which has a node field. GraphQL doesn't support generics nor an Any type, and I was unsure about creating a custom scalar type just for this purpose (assuming that that would even work).
Trying to access the runtime type of the object, in order to determine whether or not it's an instance of some kind of marker class that connection types extend.
I was not able to find a way of accessing the runtime type of the object (only the GraphQL type).
Matching the shape of a connection, by checking for the existence of edges and pageInfo fields.
This felt a bit hacky and somewhat fragile, although it is what Join Monster uses.
Using a directive, like @connection.
This pushes the responsibility of marking a connection to the client, which is not ideal.
It could also conflict with the connection directive in Apollo, etc.
Yet another option, more specific to TypeGraphQL, would be for TypeGraphQL to automatically put the return type somewhere inside extensions. For example:
Duplicate of #124 🔒
The title might be misleading but the way of putting additional stuff into the types evolved from "hack" of just placing the properties into the object to a dedicated "extensions" property with a dictionary.
Is your feature request related to a problem? Please describe.
I'm considering using the
extensions
property to mark an object type as being a (Relay) connection, but it's not possible to set this property via theField
orFieldResolver
decorators.I want to do so, so that a resolver can use the
GraphQLResolveInfo
to determine whether or not an object is a connection, in order to apply special handling during the process of automatically generating a TypeORM query builder.Describe the solution you'd like
Something like:
i.e. Adding
extensions
somewhere insideAdvancedOptions
.Describe alternatives you've considered
Edge
, which has anode
field. GraphQL doesn't support generics nor anAny
type, and I was unsure about creating a custom scalar type just for this purpose (assuming that that would even work).edges
andpageInfo
fields.@connection
.Yet another option, more specific to TypeGraphQL, would be for TypeGraphQL to automatically put the return type somewhere inside
extensions
. For example:Given:
TypeGraphQL would add:
... to the GraphQL type, which would enable alternative
#2
above, as well as make alternative#3
a little bit easier.There may be better options that I've not yet considered.
Additional context
n/a
The text was updated successfully, but these errors were encountered: