@graphql-inspector/core
Changelog for @graphql-inspector/core: every release with its changes and the pull requests behind them.
8.1.5
Patch Changes
-
#2999
3e5344eThanks @eddeee888! -DIRECTIVE_ARGUMENT_ADDEDnow takes the argument’s default value into account, the same wayFIELD_ARGUMENT_ADDEDdoes. Adding an argument with a default value to an existing directive is reported asDANGEROUSinstead ofBREAKING(non-null) orNON_BREAKING(nullable). Adding a non-null argument without a default value is stillBREAKING. -
#3012
1b386edThanks @eddeee888! - Fixcoverage()root operation stats so each root field is counted once and custom root type names are supported.
8.1.4
Patch Changes
- #3003
877ad2bThanks @n1ru4l! - ReportFIELD_ARGUMENT_DEFAULT_CHANGED(and the directive/input field equivalents) when a nested input field default changes on GraphQL 17, matching GraphQL 16 behavior.
8.1.3
Patch Changes
- #3006
2820dd8Thanks @n1ru4l! - Speed updiffwith thesimplifyChangesrule for large schema additions. The changes nested under an added type or directive (its fields, arguments, directive usages, …) are no longer computed, sincesimplifyChangesremoves them anyway. The result is unchanged, but rules that run beforesimplifyChangesno longer receive these nested changes.
8.1.2
Patch Changes
- #3004
a24f2d2Thanks @n1ru4l! - Speed up thesimplifyChangesdiff rule for large additions, such as a new type with many fields.
8.1.1
Patch Changes
-
#2998
ab6b90dThanks @eddeee888! -coverage()no longer throws when a document selects the__typeintrospection field. All__-prefixed meta-fields (__typename,__schema,__type) are skipped. -
#3001
c5dbf87Thanks @n1ru4l! - Improvediff()performance on schemas with many directive usages (e.g. federation supergraphs). Directive argument values are now compared structurally instead of printing both AST values to strings. -
#3002
9c84845Thanks @n1ru4l! - Speed updiff()for large schemas where most of the schema is unchanged (e.g. federation supergraphs). Unchanged fields are now skipped with a single cheap check, and unchanged directive usages, lists, type references and scalar/enum default values are detected without allocating intermediate maps, strings or coerced values.
8.1.0
Minor Changes
- #2987
6a147fcThanks @eddeee888! -diffno longer reports directive usages, such as@deprecated, as added or removed when one of the two schemas has no AST (for example, it was built from introspection). Those comparisons are skipped for the whole diff. When exactly one schema has an AST, the new optionalonWarningoption is called once with{ message }, which the CLI and GitHub Action print as a warning.
8.0.3
Patch Changes
- #2991
70745e6Thanks @jdolle! -FIELD_ARGUMENT_ADDEDnow reports a nullable argument without a default value, added to an existing field, asNON_BREAKINGinstead ofDANGEROUS: existing operations stay valid and the field receives no value for the argument, exactly as before. The other cases are unchanged: a non-null argument without a default value isBREAKING, and any argument with a default value isDANGEROUS, because operations that do not provide it now receive the default. The change also carries acriticality.reasonthat explains the assigned level.
8.0.2
Patch Changes
-
#2989
a6f36e3Thanks @jdolle! -simplifyChangesno longer hides changes to a node when a description, interface, union member, directive location or directive argument was added to that same node in the diff. The rule treated those additions like the addition of a whole node, so every later change at the same path or directly below it was dropped. The following changes were hidden before and are reported again:- On a field whose description was added:
FIELD_TYPE_CHANGED,FIELD_ARGUMENT_ADDED,FIELD_ARGUMENT_REMOVED,FIELD_ARGUMENT_TYPE_CHANGED,FIELD_DEPRECATION_ADDEDandDIRECTIVE_USAGE_FIELD_DEFINITION_ADDED. - On an input field whose description was added:
INPUT_FIELD_TYPE_CHANGED,INPUT_FIELD_DEFAULT_VALUE_CHANGEDandDIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_ADDED. - On a type that gained an interface:
FIELD_ADDED,FIELD_REMOVEDandFIELD_TYPE_CHANGEDon that type,DIRECTIVE_USAGE_OBJECT_ADDED, and everyOBJECT_TYPE_INTERFACE_ADDEDafter the first. - On a union that gained a member: every
UNION_MEMBER_ADDEDafter the first, andDIRECTIVE_USAGE_UNION_MEMBER_ADDED. - On a directive that gained a location:
DIRECTIVE_LOCATION_REMOVED, everyDIRECTIVE_LOCATION_ADDEDafter the first,DIRECTIVE_ARGUMENT_ADDED,DIRECTIVE_ARGUMENT_REMOVED,DIRECTIVE_ARGUMENT_TYPE_CHANGEDandDIRECTIVE_ARGUMENT_DEFAULT_VALUE_CHANGED. - On a directive that gained an argument: every
DIRECTIVE_ARGUMENT_ADDEDafter the first, andDIRECTIVE_ARGUMENT_TYPE_CHANGED,DIRECTIVE_ARGUMENT_DEFAULT_VALUE_CHANGEDandDIRECTIVE_ARGUMENT_DESCRIPTION_CHANGEDon its other arguments.
- On a field whose description was added:
8.0.1
Patch Changes
- #2982
1912c6bThanks @cpruijsen! - Fixvalidatefailing when a...sequence occurs inside a string literal in a query or fragment. Fragment references are now collected from the parsed AST instead of a regular expression over the printed document.
8.0.0
Major Changes
-
#2965
f640d71Thanks @n1ru4l! - Add support forgraphql-js@17.BREAKING Drop support for Node.js 20
BREAKING Drop support for GraphQL 14 and 15
7.1.3
Patch Changes
- #2952
3b341d4Thanks @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
14b4410Thanks @jdolle! - Add support for “extend schema” syntax to@graphql-inspector/core’sdifffunction and@graphql/inspector/patch. This allows directives to be defined on the schema such asextend schema @link(...)for federation
7.1.1
Patch Changes
- #2930
4a37c05Thanks @jdolle! - Add directive definition changes first; adjust adding repeat directive change
7.1.0
Minor Changes
-
#2923
9bfc094Thanks @jdolle! - Adjust SCHEMA_*_TYPE_CHANGED changes to use null instead of ‘unknown’ when these types are not defined and improve the change messages. -
#2923
9bfc094Thanks @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
74fcea7Thanks @adambenhassen! - Escape single quotes in diff change messages for descriptions and deprecation reasonsImprove description change messages to show “was added” or “was removed” instead of “changed from ‘undefined’ to X”
7.0.3
Patch Changes
- #2921
088cd4fThanks @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
511afb5Thanks @jdolle! - export directiveRepeatableAddedFromMeta and directiveRepeatableRemovedFromMeta
7.0.1
Patch Changes
- #2916
91b8450Thanks @jdolle! - export DirectiveRepeatableAddedChange and DirectiveRepeatableRemovedChange
7.0.0
Major Changes
-
#2893
ef13125Thanks @jdolle! - This is a major change to@graphql-inspector/coreand introduces a new@graphql-inspector/patchpackage, which applies changes output fromdiffon 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
diffoutput 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 exportedDiffRule.simplifyChangesrule.
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
Addresstype:[ { "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
2fc8b25Thanks @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
- #2908
4f1e1c1Thanks @adambenhassen! - fix payload missing directive change type
6.4.0
Minor Changes
- #2904
ad7e04bThanks @adambenhassen! - Escape single quotes in all enum descriptions and deprecation reasons
6.3.0
Minor Changes
-
#2906
2d22d32Thanks @adambenhassen! - add missing change detection of directive field usage and exports ‘directiveUsageFieldAddedFromMeta’ & ‘directiveUsageFieldRemovedFromMeta’ -
#2838
416a9ceThanks @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
- #2831
5854b64Thanks @TuvalSimha! - Change CriticalityLevel to Dangerous when directive removed
6.2.0
Minor Changes
- #2827
60d674dThanks @TuvalSimha! - Added missing types to Change type and fix typo “DirectiveUsageInputObjectdRemovedChange” to “DirectiveUsageInputObjectRemovedChange”
6.1.0
Minor Changes
-
#2775
0e40ebdThanks @DanteUkraine! - Fix: coverage calculation improvements: Covered Queries & Covered Mutations & Covered Subscriptions -
#2773
6e3ccc9Thanks @TuvalSimha! - Fix exportChangeTypefrom core package.
Patch Changes
- #2765
27edee1Thanks @renovate! - dependencies updates:- Updated dependency
dependency-graph@1.0.0↗︎ (from0.11.0, independencies)
- Updated dependency
6.0.1
Patch Changes
- #2747
9c36138Thanks @TuvalSimha! - dependencies updates:- Updated dependency
object-inspect@1.13.1↗︎ (from1.12.3, independencies)
- Updated dependency
6.0.0
Major Changes
- #2719
50874f2Thanks @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
-
#2673
831703ccThanks @kamilkisiela! - Add metadata (with change field in it) to checkUsage function of ConsiderUsage rule -
#2667
06581e0dThanks @TuvalSimha! - Replace ChangeType enum with const strings
5.0.2
Patch Changes
-
#2638
533ebfd4Thanks @TuvalSimha! - dependencies updates:- Updated dependency
tslib@2.6.2↗︎ (from2.6.0, independencies)
- Updated dependency
-
#2638
533ebfd4Thanks @TuvalSimha! - Patch update - dependencies
5.0.1
Patch Changes
-
#2569
bed4c437Thanks @TuvalSimha! - dependencies updates:- Updated dependency
tslib@2.6.0↗︎ (from2.5.3, independencies)
- Updated dependency
-
#2569
bed4c437Thanks @TuvalSimha! - Update dependencies for all packages.
5.0.0
Major Changes
- #2510
7944118eThanks @TuvalSimha! - Update major dependcies & drop node 14
Patch Changes
-
#2510
7944118eThanks @TuvalSimha! - dependencies updates:- Updated dependency
tslib@2.5.3↗︎ (from2.5.0, independencies)
- Updated dependency
-
#2425
cc303a99Thanks @jirikuncar! - Fix typo for numFiledsCovered to numFieldsCovered
4.2.2
Patch Changes
- #2452
1b1b954cThanks @TuvalSimha! - Add a new stats display for coverage command + display new Total queries / mutations / Sub
4.2.1
Patch Changes
- #2461
53dae663Thanks @TuvalSimha! - Fix complexity importing for validate
4.2.0
Minor Changes
- #2210
1180f761Thanks @taitruong007! - Support validate by complexity score
4.1.1
Patch Changes
-
#2435
09214509Thanks @TuvalSimha! - dependencies updates:- Updated dependency
tslib@2.5.0↗︎ (from^2.0.0, independencies)
- Updated dependency
-
#2435
09214509Thanks @TuvalSimha! - Update dependencies
4.1.0
Minor Changes
-
#2392
3184249bThanks @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
3184249bThanks @n1ru4l! - AddisSafeBasedOnUsagetoCriticalitytype. This value is set totruein case the criticality is set toCriticalityLevel.Dangerousbased on usage. This is helpful for statistics. -
#2392
3184249bThanks @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
Changeobject from thetypeandmetaproperties.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
34f84e8fThanks @TuvalSimha! - Updatebobversion -> change the way we build the packages (Dist folder build now esm and cjs versions)
4.0.2
Patch Changes
- #2412
5b275450Thanks @dotansimha! - Bump all packages to fix issues with previous release
4.0.1
Patch Changes
-
#2393
c00cb09bThanks @TuvalSimha! - dependencies updates:- Updated dependency
graphql@^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0↗︎ (from^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0, inpeerDependencies)
- Updated dependency
-
#2404
948981efThanks @dotansimha! - dependencies updates:- Updated dependency
graphql@^14.0.0 || ^15.0.0 || ^16.0.0↗︎ (from^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0, inpeerDependencies)
- Updated dependency
4.0.0
Major Changes
3.5.1
Patch Changes
- #2302
dd840130Thanks @renovate! - dependencies updates:- Updated dependency
object-inspect@1.12.3↗︎ (from1.10.3, independencies)
- Updated dependency