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

NEW: Field formatting API, forward compatibility #313

Merged
merged 10 commits into from
Nov 13, 2020

Conversation

unclecheese
Copy link

@unclecheese unclecheese commented Nov 2, 2020

Moved from: #310

We need backward compat for all the core modules, so they can run on either v3 or v4. It's very difficult to do this at run time because the graphql queries are bound to components at build time, so having two separate queries is both a technical challenge and also hard to maintain.

The easier solution is to allow the graphql 3 queries to look like graphql 4 queries, and the main issue there is case sensitivity.

This pull request allows the optional provision of a field formatter function and field accessor service to abstract this away. By default, you still get the naive implementation of DBField == GraphQL Field, but in admin, we'll want to take advantage of a lowerCamelCase transform.

Todo:

  • Unit testing
  • Documentation (v3 only)

Copy link
Member

@chillu chillu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Tested this with all the branches mentioned in #282.

Talked with Aaron, we've agreed to mark the new API surface as @internal and encourage usage of GraphQL v4 instead.

We'll want to merge this close to the time as all the other PRs, since it would break common dev usage such as silverstripe/cms:4.x-dev + silverstripe/graphql:3.x-dev usage otherwise.

@chillu chillu mentioned this pull request Nov 12, 2020
15 tasks
@unclecheese unclecheese merged commit 25f654c into 3 Nov 13, 2020
@unclecheese unclecheese deleted the pulls/3/schemageddon-compat branch November 23, 2020 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants