graphile / graphile/crystal

Easier way to create a type instance dynamically

Open
#2,234 0 comments 1 reaction 0 assignees View on GitHub
💅 enhancement
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

### Feature description
When dynamically adding fields using the GraphQLObjectType_fields hook, a type is required.

However, creating a type using the existing api is quite intricate. For example, creating a type like `[Orders!]!` requires something along these lines: `new build.graphql.GraphQLNonNull(new build.graphql.GraphQLList(new build.graphql.GraphQLNonNull(build.getTypeByName('Orders'))))`

Maybe a utility method to parse a type string like `'[Orders!]!'` and return a type instance?

### Motivating example

See https://discord.com/channels/489127045289476126/1296863704364879902/1298239516821426236

### Breaking changes

Don't think so

### Supporting development

I [tick all that apply]:

- [ ] am interested in building this feature myself
- [ ] am interested in collaborating on building this feature
- [ ] am willing to help testing this feature before it's released
- [ ] am willing to write a test-driven test suite for this feature (before it exists)
- [ ] am a [Graphile sponsor](https://www.graphile.org/sponsor/) ❤️
- [ ] have an active [support or consultancy contract](https://www.graphile.org/support/) with Graphile

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.