Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier way to create a type instance dynamically #2234

Open
6 tasks
p-bakker opened this issue Nov 7, 2024 · 0 comments
Open
6 tasks

Easier way to create a type instance dynamically #2234

p-bakker opened this issue Nov 7, 2024 · 0 comments

Comments

@p-bakker
Copy link

p-bakker commented Nov 7, 2024

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 ❤️
  • have an active support or consultancy contract with Graphile
@github-project-automation github-project-automation bot moved this to 🌳 Triage in V5.0.0 Nov 7, 2024
@p-bakker p-bakker changed the title Easier way to get a type Easier way to create a type instance dynamically Nov 7, 2024
@benjie benjie moved this from 🌳 Triage to 🐭 Shrew in V5.0.0 Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🐭 Shrew
Development

No branches or pull requests

2 participants