@graphql-tools/wrap
Advanced tools
Comparing version 10.0.28-alpha-055865b536b3964addc4315e6716c386f25fcfdc to 10.0.28-alpha-485484826331d137253cd2eace6cd5d798629976
# @graphql-tools/wrap | ||
## 10.0.28-alpha-055865b536b3964addc4315e6716c386f25fcfdc | ||
## 10.0.28-alpha-485484826331d137253cd2eace6cd5d798629976 | ||
### Patch Changes | ||
- Updated dependencies [[`e8878e6`](https://github.com/graphql-hive/gateway/commit/e8878e64f4cd1ea558f9ae1848b2e315883294cd)]: | ||
- @graphql-tools/delegate@10.2.10-alpha-055865b536b3964addc4315e6716c386f25fcfdc | ||
- [#472](https://github.com/graphql-hive/gateway/pull/472) [`4854848`](https://github.com/graphql-hive/gateway/commit/485484826331d137253cd2eace6cd5d798629976) Thanks [@ardatan](https://github.com/ardatan)! - `RenameObjectFieldArguments` should transform the passed `args` in `delegationContext`. | ||
When a subschema's a root field argument is renamed, the passed arguments should be also transformed; | ||
```graphql | ||
type Query { | ||
# This is the original field | ||
book(book_id: ID): [Book] | ||
} | ||
type Book { | ||
id: ID | ||
title: String | ||
} | ||
``` | ||
When the subschema above is transformed to; | ||
```graphql | ||
type Query { | ||
# This is the transformed field | ||
book(bookId: ID): [Book] | ||
} | ||
type Book { | ||
id: ID | ||
title: String | ||
} | ||
``` | ||
The following call should be transformed; | ||
```ts | ||
delegateToSchema({ | ||
schema: { | ||
schema, | ||
transforms: [ | ||
new RenameObjectFieldArguments((typeName, fieldName, argName) => { | ||
if ( | ||
typeName === 'Query' && | ||
fieldName === 'book' && | ||
argName === 'book_id' | ||
) { | ||
return 'bookId'; | ||
} | ||
return argName; | ||
}), | ||
], | ||
}, | ||
operation: 'query', | ||
fieldName: 'book', | ||
args: { | ||
bookId: '1', | ||
}, | ||
}); | ||
``` | ||
To this query; | ||
```graphql | ||
{ | ||
book(book_id: "1") { | ||
# ... | ||
} | ||
} | ||
``` | ||
## 10.0.27 | ||
@@ -11,0 +75,0 @@ |
{ | ||
"name": "@graphql-tools/wrap", | ||
"version": "10.0.28-alpha-055865b536b3964addc4315e6716c386f25fcfdc", | ||
"version": "10.0.28-alpha-485484826331d137253cd2eace6cd5d798629976", | ||
"type": "module", | ||
@@ -41,3 +41,3 @@ "description": "A set of utils for faster development of GraphQL tools", | ||
"dependencies": { | ||
"@graphql-tools/delegate": "10.2.10-alpha-055865b536b3964addc4315e6716c386f25fcfdc", | ||
"@graphql-tools/delegate": "^10.2.9", | ||
"@graphql-tools/schema": "^10.0.11", | ||
@@ -44,0 +44,0 @@ "@graphql-tools/utils": "^10.7.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
271641
5185
+ Added@graphql-tools/delegate@10.2.11(transitive)
- Removed@graphql-tools/delegate@10.2.10-alpha-055865b536b3964addc4315e6716c386f25fcfdc(transitive)