RFC: Deprecate operationName
in favour of kind
#1005
Labels
future 🔮
An enhancement or feature proposal that will be addressed after the next release
Summary
Wording is tricky, and there's currently some confusion between the following two
A - Operation type/kind
A finite set of operation types (query, mutation, subscription)
Currently this is indicated in
urql
onOperation.operationName
. It's widely used in theClient
'a andExchange
s' control flows and is confusing since it implies to refer toOperationDefinitionNode.name.value
, which is ambiguous.B - Operation name
One or more user provided names of an operation.
While this is an optional name on the
OperationDefinitionNode
and not actively observed or used inurql
it is sent sometimes by thefetchExchange
andsubscriptionExchange
for instance. This is commonly what's also referred to as the "Operation Name."Proposed Solution
Existing naming
Deprecate the
operationName
property and introduce akind
property. The deprecated property would be removed in a subsequent major update but should for the time being issue a warning (as a getter) for the next minor bump in development and at most once.Ruled out
Option 2
Do option 1 and also rename the Operation interfaces (Operation, OperationContext, OperationDebugMeta to use the term
Request
/UrqlRequest
to prevent confusion with the Operation node type in GraphQL (of which, an Urql Operation can have multiple).Re-introduce the legacy naming scheme as a deprecated alias and subsequently remove in a future major release.
Adding support for operation name
Expose the
getOperationName
utility on@urql/Core
by moving it, to allow users to get the operation name of a GraphQLDocumentNode
more easily.Ruled out
Option 2
Add a
operationNames
property to the existing Operation typeThe text was updated successfully, but these errors were encountered: