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 changing root type names #2077

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andershagbard
Copy link
Contributor

@andershagbard andershagbard commented Mar 3, 2022

  • Added or updated tests
  • Documented user facing changes
  • Updated CHANGELOG.md

This PR allows us to change the root type names.

I am not sure how it should be tested whether actually changing the values work?

Reference talk: https://lighthouse-php.slack.com/archives/CB28A070S/p1645698178486249

@spawnia
Copy link
Collaborator

spawnia commented Mar 3, 2022

We should use native SDL for changing the name of the root types, see http://spec.graphql.org/draft/#sec-Schema

@spawnia spawnia added the enhancement A feature or improvement label Mar 3, 2022
@andershagbard
Copy link
Contributor Author

We should use native SDL for changing the name of the root types, see http://spec.graphql.org/draft/#sec-Schema

Might be a bit out of my knowledge for Lighthouse and GraphQL. Could use some help if anyone is up for it.

@spawnia
Copy link
Collaborator

spawnia commented Mar 3, 2022

It is not that hard. Basically, somewhere in the schema definition - probably schema.graphql - there can be a definition like this:

schema {
  subscription: CustomSubscription
}

This definition should be accessible in DocumentAST.

src/Schema/RootType.php Outdated Show resolved Hide resolved
@spawnia spawnia marked this pull request as draft March 4, 2022 08:47
@spawnia
Copy link
Collaborator

spawnia commented Mar 4, 2022

Marked this as a draft, as the implementation is not based upon SDL yet.

I am not sure how it should be tested whether actually changing the values work?

This is going to become trivial, the test schema can simply include a schema { ... } definition with renamed root query types then.

@andershagbard andershagbard changed the title POC - Add changeable root types WIP - Add changeable root types Mar 4, 2022
@spawnia spawnia changed the title WIP - Add changeable root types Add changeable root types Aug 14, 2022
@spawnia spawnia changed the title Add changeable root types Allow changing root type names Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants