From a56443c1922b2db67d37237e68281439f4dd33c8 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 24 Apr 2024 17:34:02 +0300 Subject: [PATCH] Add changeset --- .changesets/fix_normalize_operation_name.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changesets/fix_normalize_operation_name.md diff --git a/.changesets/fix_normalize_operation_name.md b/.changesets/fix_normalize_operation_name.md new file mode 100644 index 0000000000..e598236080 --- /dev/null +++ b/.changesets/fix_normalize_operation_name.md @@ -0,0 +1,15 @@ +### Normalize "operation_name" value inside supergraph request ([Issue #5014](https://github.com/apollographql/router/issues/5014)) + +At present, the behavior of `request.body.operation_name` in Rhai scripts is such that it is a direct copy of `operationName` from the client request. +So `request.body.operation_name` can be empty even if `query` contains a named query. For example: +```json +{ + "query": "query OperationName { me { id } }" +} +``` +In this case, `request.body.operation_name` was empty because the client didn't specify `operationName.` + +This behavior is very confusing to users who expect it to have an operation name if `query` contains a named query. +After this change, `request.body.operation_name` will always default to the operation name extracted from parsed `query`. + +By [@IvanGoncharov](https://github.com/IvanGoncharov) in https://github.com/apollographql/router/pull/5008