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

Allow the use of existing types when defining GraphQL type fields #9626

Closed
membla opened this issue Jul 22, 2021 · 2 comments
Closed

Allow the use of existing types when defining GraphQL type fields #9626

membla opened this issue Jul 22, 2021 · 2 comments
Assignees
Labels
bug graphql ⚙️ features related to the GraphQL API

Comments

@membla
Copy link

membla commented Jul 22, 2021

Description

When listening to the EVENT_DEFINE_GQL_TYPE_FIELDS event in order to modify field definitions for a specific GraphQL type the GqlEntityRegistry is not guaranteed to contain the desired type (if we wish to use a circular type reference, it will never be), meaning we will not be able to define the type of the field as desired.

@membla membla added the bug label Jul 22, 2021
@membla membla changed the title Allow the use existing types when defining GraphQL type fields Allow the use of existing types when defining GraphQL type fields Jul 22, 2021
@andris-sevcenko andris-sevcenko added this to the 4.0 milestone Jul 26, 2021
@andris-sevcenko
Copy link
Contributor

@membla I got it working locally for entry types by shifting the event trigger point to when the fields are actually resolved, as opposed to the type being created.

However, this change has to occur in the type generators, which means that plugins would need to adjust their code as well. Further, this changes the point in time when the event is fired, which also makes it a backward-compatiblity sensitive change.

This means that fixing this will have to wait until Craft 4.0

@andris-sevcenko andris-sevcenko added the graphql ⚙️ features related to the GraphQL API label Jul 26, 2021
andris-sevcenko pushed a commit that referenced this issue Sep 30, 2021
…w fired when actually resolving fields for a GraphQL Type, instead of being fired when the type is first created.

Resolve #9626
@andris-sevcenko
Copy link
Contributor

@membla just fixed this for the 4.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug graphql ⚙️ features related to the GraphQL API
Projects
None yet
Development

No branches or pull requests

2 participants