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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger nested changes to new types and fields #33

Open
guialbuk opened this issue Oct 27, 2020 · 0 comments
Open

Trigger nested changes to new types and fields #33

guialbuk opened this issue Oct 27, 2020 · 0 comments

Comments

@guialbuk
Copy link

Hi 馃憢

For the schema comparison:

Old Schema:

type Query {}

New schema:

type Query {}

type App {
  name(
    foo: String
  ): String
}

The current behaviour only triggers one change:

Changes::TypeAdded

But for linting purposes, it's important to have the full set of changes:

Changes::TypeAdded
Changes::FieldAdded
Changes::FieldArgumentAdded

I'm proposing an option to return the nested schema changes for new types and fields.

This can be done by comparing the new types and fields to empty versions of them. Comparing the new type with an empty one returns Changes::FieldAdded and comparing this field with an empty one returns Changes::FieldArgumentAdded.

An approach like this does not require modifying the Change classes. It can be done in Schema::Diff or by having a similar class that does this "recursive" schema comparison.

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

No branches or pull requests

1 participant