Skip to content

Pass operation name to the operation registry signature function#1115

Merged
trevor-scheer merged 1 commit intorelease-apollo-3.xfrom
trevor/pass-operation-name
Mar 13, 2019
Merged

Pass operation name to the operation registry signature function#1115
trevor-scheer merged 1 commit intorelease-apollo-3.xfrom
trevor/pass-operation-name

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

This PR corrects a previous oversight.

Operation names found during extraction by the language server should be passed along (by the CLI) to the signature function.

Failure to do so would result in publishing the full document, and we would fail to drop unused definitions in the process.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

Copy link
Copy Markdown
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! This is the correct solution what what I attempted to solve with #1114!

@trevor-scheer trevor-scheer merged commit 5e5b13b into release-apollo-3.x Mar 13, 2019
@trevor-scheer trevor-scheer deleted the trevor/pass-operation-name branch March 13, 2019 17:32
abernix pushed a commit that referenced this pull request Apr 2, 2019
This includes the work from #1027, #1115 and #1118, which first surfaced in
an `apollo@next` CLI version which was released in order to provide a
migration path for paying customers who utilize the Apollo Operation
Registry through the CLI's `apollo client:push` features.

Those customers were notified and advised to either pin their `apollo`
version prior to this being released, so the hope is that we'll be able to
released this under the `apollo@2` cover without incurring breaking changes
on anyone else.

The summary of the relevant commit messages is below:

1) Remove duplication from client:push and client:extract.
2) Create a test to verify upcoming changes for this PR.

Cutover to apollo-graphql

* Add apollo-graphql as a dependency (and project reference)
* Remove apollo-engine-reporting as a dependency
* Update sortAST to normalize order of fragments w.r.t operations
* Tests are failing expectedly at this point

Centralize operation hashing function

These two operations will likely be used in tandem, and we want this to be consistent across consumers.

Incorporate rename suggestions

Update version for extracted manifest output.

Use empty string and add comment about unused metadata field.

Revert changes to defaultEngineReportingSignature. Apply changes to new function, defaultOperationRegistrySignature.

This new function is the effective interim fix, and the current existing function is now left alone.

Pass operation name along to the operation registry signature function

Leverage updated registerOperations API

Now that registerOperations supports version as an argument
to the mutation, we can leverage this for v2 oeprations manifest
work.
abernix pushed a commit that referenced this pull request Apr 2, 2019
This includes the work from #1027, #1115 and #1118, which first surfaced in
an `apollo@next` CLI version which was released in order to provide a
migration path for paying customers who utilize the Apollo Operation
Registry through the CLI's `apollo client:push` features.

Those customers were notified and advised to either pin their `apollo`
version prior to this being released, so the hope is that we'll be able to
released this under the `apollo@2` cover without incurring breaking changes
on anyone else.

The summary of the relevant commit messages is below:

1) Remove duplication from client:push and client:extract.
2) Create a test to verify upcoming changes for this PR.

Cutover to apollo-graphql

* Add apollo-graphql as a dependency (and project reference)
* Remove apollo-engine-reporting as a dependency
* Update sortAST to normalize order of fragments w.r.t operations
* Tests are failing expectedly at this point

Centralize operation hashing function

These two operations will likely be used in tandem, and we want this to be consistent across consumers.

Incorporate rename suggestions

Update version for extracted manifest output.

Use empty string and add comment about unused metadata field.

Revert changes to defaultEngineReportingSignature. Apply changes to new function, defaultOperationRegistrySignature.

This new function is the effective interim fix, and the current existing function is now left alone.

Pass operation name along to the operation registry signature function

Leverage updated registerOperations API

Now that registerOperations supports version as an argument
to the mutation, we can leverage this for v2 oeprations manifest
work.
abernix pushed a commit that referenced this pull request Apr 2, 2019
This includes the work from #1027, #1115 and #1118, which first surfaced in
an `apollo@next` CLI version which was released in order to provide a
migration path for paying customers who utilize the Apollo Operation
Registry through the CLI's `apollo client:push` features.

Those customers were notified and advised to either pin their `apollo`
version prior to this being released, so the hope is that we'll be able to
released this under the `apollo@2` cover without incurring breaking changes
on anyone else.

For more information on the operation registry, see:

https://www.apollographql.com/docs/platform/operation-registry.html

And if you encounter any problems, please contact our customer support via
Intercom from within your Engine UI.

---

The summary of the relevant commit messages is below:

1) Remove duplication from client:push and client:extract.
2) Create a test to verify upcoming changes for this PR.

Cutover to apollo-graphql

* Add apollo-graphql as a dependency (and project reference)
* Remove apollo-engine-reporting as a dependency
* Update sortAST to normalize order of fragments w.r.t operations
* Tests are failing expectedly at this point

Centralize operation hashing function

These two operations will likely be used in tandem, and we want this to be consistent across consumers.

Incorporate rename suggestions

Update version for extracted manifest output.

Use empty string and add comment about unused metadata field.

Revert changes to defaultEngineReportingSignature. Apply changes to new function, defaultOperationRegistrySignature.

This new function is the effective interim fix, and the current existing function is now left alone.

Pass operation name along to the operation registry signature function

Leverage updated registerOperations API

Now that registerOperations supports version as an argument
to the mutation, we can leverage this for v2 oeprations manifest
work.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 6, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 6, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 12, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 12, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 14, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 14, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 14, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
trevor-scheer pushed a commit to apollographql/apollo-server that referenced this pull request May 14, 2020
Start passing the `operationName` to `defaultOperationRegistrySignature`.

apollographql/apollo-tooling#1115

If `operationName` is `null`, then the operation is anonymous.  However,
it's not possible to register anonymous operations from the `apollo` CLI.
We could fail early, however, we still want to abide by the desires of
`forbidUnregisteredOperations`, so we'll allow this hash be generated
anyway.  The hash cannot be in the manifest, so this would be okay and allow
this code to remain less conditional-y, eventually forbidding the operation
when the has is not found and `forbidUnregisteredOperations` is on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants