graphql-hive icon indicating copy to clipboard operation
graphql-hive copied to clipboard

(processVariables: true) do not collect input if variable is missing

Open dimatill opened this issue 2 years ago • 3 comments

Fix for the case when an optional variable is not provided

dimatill avatar Oct 05 '22 12:10 dimatill

🦋 Changeset detected

Latest commit: abd836213d892332fde4f25bfe47f6d9d7e9f85a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-hive/client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 05 '22 12:10 changeset-bot[bot]

@kamilkisiela , I just pushed new changes. I didn't test anything yet, but it looks to me like it SHOULD be ok this way both from UI and GraphQL Inspector perspectives. Just want to hear your opinion before going forward.

dimatill avatar Oct 05 '22 17:10 dimatill

@kamilkisiela I've tested it manually with a local instance of Hive and it looks good to me. The test was done with the same schema as in usage-collector.spec.ts. The test scenario was the same as in (processVariables: true) should not collect input when corresponding variable is not provided test case.

Please check attached screenshots. Here is a description of screenshots:

In the UI I can see that PaginationInput was used 1 time while all fields were used zero times. This could be a little bit confusing, but this is what actually happened: fields weren't used but the input itself was used in the query definition.

hive schema:check also works as expected: removing FilterInput.order and ProjectOrderByInput is considered a non-breaking change because they weren't used. Removing PaginationInput and FilterInput.pagination is considered a breaking change because they were used in the query.

What do you think? Can we merge this PR?

Screenshot 2022-10-09 at 17 50 25 Screenshot 2022-10-09 at 18 07 37

dimatill avatar Oct 09 '22 16:10 dimatill

Thank you very very very much

kamilkisiela avatar Oct 25 '22 14:10 kamilkisiela

I will deploy it to production tomorrow

kamilkisiela avatar Oct 25 '22 14:10 kamilkisiela

woohoo, thank you @kamilkisiela !

dimatill avatar Oct 25 '22 14:10 dimatill