-
-
Notifications
You must be signed in to change notification settings - Fork 207
Add patch package to apply diff changes to schemas #2893
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
base: master
Are you sure you want to change the base?
Conversation
| meta: { | ||
| directiveName: oldDirective.name, | ||
| oldDirectiveDescription: oldDirective.description ?? null, | ||
| directiveName: newDirective.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases, the type is being used to extract the name only. It doesn't matter if we pass the new or old directive, since the name is the same. However, since calling these functions onAdd -- the old type can be null, which is why this was changed to pass the new type (newDirective)
|
|
||
| { | ||
| const change = findFirstChangeByPath(changes, 'enumA.A'); | ||
| expect(change.criticality.level).toEqual(CriticalityLevel.NonBreaking); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test shows that enum additions also contain all nested changes within that enum, and that those changes are flagged as non-breaking.
| parentType: type, | ||
| field: newField, | ||
| }), | ||
| directiveUsageAdded( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this filter out the deprecated directive since that's captured by another change?
Adjusted |
dotansimha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I added a few minor comments, mainly around release pipeline.
We can proceed once @n1ru4l confirms it's good to go.
Thanks!
Description
This change began as one to only the adds fields that are necessary for recreating the patched schema using the input schema and changes array, but it has expanded to also add the patch functionality. I found this was necessary in order to verify that the changes provided sufficient data.
This PR modifies the several change types, and modifies the
onAddedhandlers to also execute equivalent logic toonMutual. It also adds a new rule that can be added to filter out these additional changes, thus keeping changelogs to a minimum. Paths also needed changed to consistently and uniquely map to the node being changed. Previously, some changes referenced a parent's coordinate. Lastly, directives support was dramatically improved and the directive path was modified to include@to distinguish it from any other node potentially with the same name.The expansion of "onAdded" has a few down sides and an important up side.
Cons
onAddedcall. Because e.g. adding an interface to newly create object is completely safe, but adding an interface to an existing object is considered dangerous.Pro
Type of change
How Has This Been Tested?
See unit tests.
Checklist:
CONTRIBUTING doc and the
style guidelines of this project