dotansimha / dotansimha/graphql-code-generator

graphql executor plugin

Open
#7,792 5 comments 0 reactions 0 assignees View on GitHub
core
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

Looks like there's no plugin for plain [graphql](https://www.npmjs.com/package/graphql) package. This kind of plugin would come in handy when testing backend resolvers. The plugin would automatically wrap the executable schema (path taken from plugin settings) and be strongly typed so that tests could gain better type safety. An example usage could look like:

`const result = await executeMyGaphqlQuery(ctx, variables);`

The generated code would roughly look something like:

```
export function execute${operationName}(ctx: any, variables: ${operationVariablesTypes}): Promise> {
return graphql(schema, documentVariableName, undefined, ctx, variables);
};
```

```typescript
export function executeMyGaphqlQuery(ctx: any, variables: Variables): Promise> {
return graphql(schema, documentVariableName, undefined, ctx, variables);
};`
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.