Skip to content

Trigger nested changes to new types and fields #33

@guialbuk

Description

@guialbuk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions