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

Feature Request: Mutation Support #109

Open
jasonbahl opened this issue Nov 1, 2023 · 3 comments
Open

Feature Request: Mutation Support #109

jasonbahl opened this issue Nov 1, 2023 · 3 comments
Labels
status: blocked Progress halted due to dependencies or issues

Comments

@jasonbahl
Copy link
Contributor

jasonbahl commented Nov 1, 2023

What problem does this address?

As a developer building headless sites and applications with WPGraphQL and Advanced Custom Fields, I would like to be able to mutate ACF data using GraphQL Mutations.

What is your proposed solution?

Similar to how ACF Field Groups and Fields are exposed to the Schema as Types and Fields that can be queried, the field groups and fields should also be exposed to the Schema as Input Types and associated with the corresponding mutations (createPost, etc)


What alternatives have you considered?


Additional Context

This issue is currently considered blocked for the following reasons:

Access Control

We believe there needs to be a lot more work on the core ACF side to define access control. What fields can be edited by what users (which capabilities, etc)

Of course, WPGraphQL could solve this to some degree, but we believe it's a more central issue as fields could be edited in the admin UI, CLI, REST, GraphQL, etc, so core ACF should provide more ways to formally lock down which fields can/cannot be modified by certain users.

GraphQL oneOf Directive / Input Unions

GraphQL has the concept of Unions and Interfaces for queries, which allows the response to return "one of" many possible types.

For example, we can query contentNode and get "one of" the many Types that represent a WordPress Post Type (Page, Post, etc)

Or we can query nodeByUri() and get "one of" the many possible Types that can be accessed by a uri (Post, Page, User, Category, Tag, etc)

When it comes to inputting data, GraphQL does not (yet) support the concept of inputting "one of" many different possible types.

This is a critical feature, in our mind, to be able to properly support mutations for ACF because the Types of data that can be input could easily be "one of" many different Types. Especially, but certainly not limited to, when inputting data for field Types such as Flexible Content would be needed.

The GraphQL Spec currently has an RFC open for this concept: graphql/graphql-spec#825

Until this feature becomes part of the GraphQL Spec ,and then GraphQL-PHP, and then WPGraphQL, we will not be officially supporting GraphQL mutations for ACF.

@nestarz
Copy link

nestarz commented Nov 20, 2023

@jasonbahl The critical feature you are waiting might take years before landing into GraphQL spec, and might never happens, maybe we should not wait for it before supporting this feature as the community extension you linked has proven it's feasible by another way.

@jasonbahl
Copy link
Contributor Author

@nestarz If the community extension is working for your projects, I recommend you continue using it!

As a maintainer, I don't want to maintain something I'm not comfortable maintaining long-term, and I don't feel like I want to support mutations until these features are available in GraphQL.

I've built the plugins to be extendable so that users can customize the Schema for their projects.

Hopefully we see more traction on the oneOf directives, etc, but until then I don't feel comfortable building/supporting these features.

@siamahnaf
Copy link

Currently we are trying to use Wordpress as Headless CMS. If you can add it. it would be helpful for all developer community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked Progress halted due to dependencies or issues
Projects
None yet
Development

No branches or pull requests

3 participants