[Feature] Remove rest using a future flag #1701
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Shopify is all-in on graphql. By adding this future flag now we can:
WHAT is this pull request doing?
v4_removeRest
future flag: It is false by default. When it is true methods for interacting with Rest will never be in the admin context object. This affects a lot of methods, so there are a lot of changes. Most of hich come from maintaining type safety.v4_removeRest
will be false by default. So a lot of these changes are to do with that.expectAdminApiClient
to receive anadmin
object that should not cntain anything o do with REST. Then each test that usesexpectAdminApiClient
is updated to pass an admin object wherev4_removeRest
is true and an admin object wherev4_removeRest
is false.admin.rest
as deprecated, with a link to the blog post.Tophatting
The most important questions are:
v4_removeRest
isundefined
. There should be no changes.v4_removeRest
isfalse
. There should be no changes.v4_removeRest
istrue
is REST returned from any of the methods? It should not be returned. The types should match.Future note
Because of the complexity of our types, the easiest way to remove REST in v4 is probably to revert this PR, then remove REST. If we just manually revert all these changes I worry we'll end up with some complexity in our tests and types that does not need to be there.
Type of change
Checklist
pnpm changeset
to create a draft changelog entry (do NOT update theCHANGELOG.md
files manually)