-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grpc):
selectQueryOrMutationField
- Loading branch information
Showing
17 changed files
with
298 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
'@graphql-mesh/openapi': patch | ||
'@graphql-mesh/grpc': patch | ||
'@graphql-mesh/raml': patch | ||
'@omnigraph/openapi': patch | ||
'@graphql-mesh/types': patch | ||
'@omnigraph/grpc': patch | ||
'@omnigraph/raml': patch | ||
--- | ||
|
||
New option `selectQueryOrMutationField` to decide which field belongs to which root type explicitly. | ||
|
||
```ts filename="mesh.config.ts" | ||
import loadGrpcSubgraph from '@omnigraph/grpc' | ||
import { defineConfig } from '@graphql-mesh/compose-cli' | ||
|
||
export const composeConfig = defineConfig({ | ||
subgraphs: [ | ||
{ | ||
sourceHandler: loadGrpcSubgraph('MyGrpcApi', { | ||
/** .. **/ | ||
|
||
// Prefix to collect Query method default: list, get | ||
prefixQueryMethod: ['list', 'get'], | ||
|
||
// Select certain fields as Query or Mutation | ||
// This overrides `prefixQueryMethod` | ||
selectQueryOrMutationField: [ | ||
{ | ||
// You can use a pattern matching with * | ||
fieldName: '*RetrieveMovies', | ||
type: 'Query', | ||
}, | ||
// Or you can use a specific field name | ||
// This will make the field GetMovie available as a Mutation | ||
// Because it would be Query because of `prefixQueryMethod` | ||
{ | ||
fieldName: 'GetMovie', | ||
type: 'Mutation' | ||
} | ||
] | ||
}) | ||
} | ||
] | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.