On this page

@graphql-inspector/core

Changelog for @graphql-inspector/core: every release with its changes and the pull requests behind them.

8.0.0

Major Changes

  • #2965 f640d71 Thanks @n1ru4l! - Add support for graphql-js@17.

    BREAKING Drop support for Node.js 20

    BREAKING Drop support for GraphQL 14 and 15

7.1.3

Patch Changes

  • #2952 3b341d4 Thanks @jdolle! - “INPUT_FIELD_ADDED” is now classified as Dangerous (was NonBreaking) when the added field has a default value, since rolling deploys can expose consumers to the default before producers are ready.

7.1.2

Patch Changes

  • #2934 14b4410 Thanks @jdolle! - Add support for “extend schema” syntax to @graphql-inspector/core’s diff function and @graphql/inspector/patch. This allows directives to be defined on the schema such as extend schema @link(...) for federation

7.1.1

Patch Changes

  • #2930 4a37c05 Thanks @jdolle! - Add directive definition changes first; adjust adding repeat directive change

7.1.0

Minor Changes

  • #2923 9bfc094 Thanks @jdolle! - Adjust SCHEMA_*_TYPE_CHANGED changes to use null instead of ‘unknown’ when these types are not defined and improve the change messages.

  • #2923 9bfc094 Thanks @jdolle! - diff can be passed null schemas. This lets it output the full list of additions on the new schema.

7.0.4

Patch Changes

  • #2924 74fcea7 Thanks @adambenhassen! - Escape single quotes in diff change messages for descriptions and deprecation reasons

    Improve description change messages to show “was added” or “was removed” instead of “changed from ‘undefined’ to X”

7.0.3

Patch Changes

  • #2921 088cd4f Thanks @jdolle! - Fix simplifyChanges for sibling changes. E.g. if User.foo and User.bar were added, then the later would be filtered out when it shouldn’t be filtered.

7.0.2

Patch Changes

  • #2919 511afb5 Thanks @jdolle! - export directiveRepeatableAddedFromMeta and directiveRepeatableRemovedFromMeta

7.0.1

Patch Changes

  • #2916 91b8450 Thanks @jdolle! - export DirectiveRepeatableAddedChange and DirectiveRepeatableRemovedChange

7.0.0

Major Changes

  • #2893 ef13125 Thanks @jdolle! - This is a major change to @graphql-inspector/core and introduces a new @graphql-inspector/patch package, which applies changes output from diff on top of a schema — essentially rebasing these changes onto any schema.

    These changes include:

    • Numerous adjustments to Change types to create more accurate severity levels, such as a boolean indicating if the change applies to a new type or an existing type.
    • Adjustmented the “path” on several change types in order to consistently map to the exact AST node being changed. For example, EnumValueDeprecationReasonAdded’s path previously referenced the enumValue (e.g. EnumName.value), not the deprecated directive (e.g. EnumName.value.@deprecated).
    • Added new attributes in order to provide enough context for a new “@graphql-inspector/patch” function to apply changes accurately.
    • Added support for repeatable directives
    • Includes all nested changes in diff output when a new node is added. This can dramatically increase the number of changes listed which can be noisy, but it makes it possible for “@graphql-inspector/patch” to apply all changes from a schema. This can be optionally filtered using a newly exported DiffRule.simplifyChanges rule.

    For example, given an existing schema:

    type User {
      id: ID!
      name: String!
    }

    And a diff schema:

    type User {
      id: ID!
      name: String!
      address: Address
    }
    
    type Address {
      line1: String!
      line2: String!
    }

    Then previously the output would be:

    [
      {
        "criticality": {
          "level": "NON_BREAKING"
        },
        "message": "Type 'Address' was added",
        "meta": {
          "addedTypeKind": "ObjectTypeDefinition",
          "addedTypeName": "Address"
        },
        "path": "Address",
        "type": "TYPE_ADDED"
      },
      {
        "criticality": {
          "level": "NON_BREAKING"
        },
        "message": "Field 'address' was added to object type 'User'",
        "meta": {
          "addedFieldName": "address",
          "addedFieldReturnType": "Address",
          "typeName": "User",
          "typeType": "object type"
        },
        "path": "User.address",
        "type": "FIELD_ADDED"
      }
    ]

    But now the output also includes the fields inside the new Address type:

    [
      {
        "criticality": {
          "level": "NON_BREAKING"
        },
        "message": "Type 'Address' was added",
        "meta": {
          "addedTypeKind": "ObjectTypeDefinition",
          "addedTypeName": "Address"
        },
        "path": "Address",
        "type": "TYPE_ADDED"
      },
      {
        "criticality": {
          "level": "NON_BREAKING"
        },
        "message": "Field 'line1' was added to object type 'Address'",
        "meta": {
          "addedFieldName": "line1",
          "addedFieldReturnType": "String!",
          "typeName": "Address",
          "typeType": "object type"
        },
        "path": "Address.line1",
        "type": "FIELD_ADDED"
      },
      {
        "criticality": {
          "level": "NON_BREAKING"
        },
        "message": "Field 'line2' was added to object type 'Address'",
        "meta": {
          "addedFieldName": "line2",
          "addedFieldReturnType": "String!",
          "typeName": "Address",
          "typeType": "object type"
        },
        "path": "Address.line2",
        "type": "FIELD_ADDED"
      },
      {
        "criticality": {
          "level": "NON_BREAKING"
        },
        "message": "Field 'address' was added to object type 'User'",
        "meta": {
          "addedFieldName": "address",
          "addedFieldReturnType": "Address",
          "typeName": "User",
          "typeType": "object type"
        },
        "path": "User.address",
        "type": "FIELD_ADDED"
      }
    ]

    These additional changes can be filtered using a new rule:

    import { diff, DiffRule } from '@graphql-inspector/core'
    
    const changes = await diff(a, b, [DiffRule.simplifyChanges])

Minor Changes

  • #2900 2fc8b25 Thanks @emileriksson! - Apollo Federation v2 support. Introduced built-in Federation v2 directives and a new CLI flag —federationV2 to enable processing schemas that use them.

6.4.1

Patch Changes

6.4.0

Minor Changes

6.3.0

Minor Changes

  • #2906 2d22d32 Thanks @adambenhassen! - add missing change detection of directive field usage and exports ‘directiveUsageFieldAddedFromMeta’ & ‘directiveUsageFieldRemovedFromMeta’

  • #2838 416a9ce Thanks @egoodwinx! - Updated removing field message to contain more information on why its a breaking change such as if the field is a union or indirectly referenced.

6.2.1

Patch Changes

6.2.0

Minor Changes

  • #2827 60d674d Thanks @TuvalSimha! - Added missing types to Change type and fix typo “DirectiveUsageInputObjectdRemovedChange” to “DirectiveUsageInputObjectRemovedChange”

6.1.0

Minor Changes

Patch Changes

6.0.1

Patch Changes

6.0.0

Major Changes

  • #2719 50874f2 Thanks @TuvalSimha! - Upgrade the Node version from 16 to 18, as the minimum required version is now 18. Additionally, ensure that GraphQL Yoga is upgraded to version 5.

5.1.0

Minor Changes

5.0.2

Patch Changes

5.0.1

Patch Changes

5.0.0

Major Changes

Patch Changes

4.2.2

Patch Changes

  • #2452 1b1b954c Thanks @TuvalSimha! - Add a new stats display for coverage command + display new Total queries / mutations / Sub

4.2.1

Patch Changes

4.2.0

Minor Changes

4.1.1

Patch Changes

4.1.0

Minor Changes

  • #2392 3184249b Thanks @n1ru4l! - Wrap string values in quotes, so they can be differentiated from types.

    - Input field 'Foo.b' default value changed from 'undefined' to 'Bbb'
    + Input field 'Foo.b' default value changed from 'undefined' to '"Bbb"'
  • #2392 3184249b Thanks @n1ru4l! - Add isSafeBasedOnUsage to Criticality type. This value is set to true in case the criticality is set to CriticalityLevel.Dangerous based on usage. This is helpful for statistics.

  • #2392 3184249b Thanks @n1ru4l! - include meta data in the changes that are machine processable. This is useful if you want to efficiently store the changes in some database and later-on reconstruct the full change objects.

    export type FieldDescriptionChangedChange = {
      type: ChangeType.FieldDescriptionChanged
      meta: {
        typeName: string
        fieldName: string
        oldDescription: string
        newDescription: string
      }
    }

    You can construct the full Change object from the type and meta properties.

    import { ChangeType, fieldDescriptionChangedFromMeta } from '@graphql-inspector/core'
    
    console.log(
      fieldDescriptionChangedFromMeta({
        type: ChangeType.FieldDescriptionChanged,
        meta: {
          typeName: 'Foo',
          fieldName: 'bar',
          oldDescription: 'This is the old description',
          newDescription: 'This is the new description'
        }
      })
    )

    console.log output:

    {
      type: 'FIELD_DESCRIPTION_CHANGED',
      criticality: { level: 'NON_BREAKING' },
      message: "Field 'Foo.bar' description changed from 'This is the old description' to 'This is the new description'",
      meta: {
        typeName: 'Foo',
        fieldName: 'bar',
        oldDescription: 'This is the old description',
        newDescription: 'This is the new description'
      },
      path: 'Foo.bar'
    }

4.0.3

Patch Changes

  • #2419 34f84e8f Thanks @TuvalSimha! - Update bob version -> change the way we build the packages (Dist folder build now esm and cjs versions)

4.0.2

Patch Changes

4.0.1

Patch Changes

4.0.0

Major Changes

3.5.1

Patch Changes

3.5.0

Minor Changes

  • #2240 ca29cdd1 Thanks @Tohaker! - suppressRemovalOfDeprecatedField rule will now mark removed types as dangerous