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

Create and update mutations should be created with post types or field groups #75

Closed
ArkDouglas opened this issue Aug 6, 2023 · 3 comments
Labels
status: actionable Ready for work to begin type: enhancement Improvements to existing functionality

Comments

@ArkDouglas
Copy link

What problem does this address?

This allows wpgrpahql-acf to fully empower the use of graphql for ACF. Currently, it only exposes read support.

What is your proposed solution?

Registration hooks similar to atlas content modeler that allow the fields and post types to expose the meta fields necessary for creating and updating via GraphQL

What alternatives have you considered?

Custom coding, which nullfiies the purpose of the ACF and wpgraphql-acf combo, so it's more of an 'abandon' then a solution.

Additional Context

Atlas Content Modeler allows creating custom types and then registers the proper mutations in graphql to support updating and creating the content via graphql.

@justlevine
Copy link

Never used ACM, but would like to weigh in from a security perspective that if this does get added any ACF fields should have to opt in via a toggle to be available as a mutation input.

There's no GUI for a permissions layer, and most users defining their GraphQL fields with ACF aren't of the demographic that would naturally pause to consider whether they want anyone who can run the mutation to be able to update certain ACF values.

@jasonbahl
Copy link
Contributor

jasonbahl commented Aug 11, 2023

Hey!

We plan to visit this at some point, but there's some limitations to GraphQL that we believe make this hard / impossible to achieve in an optimal way.

GraphQL has Interfaces and Unions for querying data, but does not have the same concept for Inputs. We believe this is necessary to fully support Mutations for ACF.

I've been wanting this feature in GraphQL for a long time (see: graphql/graphql-js#207 (comment)).

There's been progress made with the @oneOf directive, which was recently merged into GraphQL-JS, but not yet formally released or added to the GraphQL Spec.

Once it makes its way to the GraphQL Spec and a formal release of GraphQL-JS, I anticipate GraphQL-PHP adding this functionality (even if we have to contribute to make that happen) making it possible for WPGraphQL to then take advantage of it as well.


I also agree with @justlevine that there should also be more consideration as to who should / should not be able to mutate specific fields. (fwiw, I think this should happen at a wider level than WPGraphQL. ACF should, in my opinion add a more granular field-level permission system that all APIs (WPGraphQL, REST, CLI, the wp-admin, etc) should be able to benefit from.

@jasonbahl jasonbahl added the type: enhancement Improvements to existing functionality label Aug 11, 2023
@jasonbahl jasonbahl added the status: actionable Ready for work to begin label Sep 14, 2023
@jasonbahl
Copy link
Contributor

I'm going to close this in favor of #109 where we'll track this going forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: actionable Ready for work to begin type: enhancement Improvements to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants