Skip to content
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

Adding @Undocumented decorator to prevent Query/Mutation/Subscription from getting generated in SDL #2529

Open
1 task done
bneigher opened this issue Dec 2, 2022 · 2 comments
Labels

Comments

@bneigher
Copy link

bneigher commented Dec 2, 2022

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

When making services that are part of a Federated Apollo Gateway, it would be nice to control which Operations are not to be generated with the code-first approach... which subsequently is to be printed with printSchema or printSchemaWithDirectives

image

Because Apollo Federated Gateway doesn't support Subscriptions, for example, attempting to publish a SDL .grahpql with Subscriptions results in an error...

By hiding some Operations from the printed out SDL file, additional functionalities could still be exposed from the GQL downstream service (obviously without stitching support)

Describe the solution you'd like

If there was a directive @Undocumented used like illustrated below:

@Undocumented()
@Subscription(() => [Model])
modelTopic() {
   return this.pubSub.asyncIterator('modelTopic')
}

We could maintain this Subscription as a feature of the service, while essentially not informing the Gateway of it's existence since the SDL wouldn't have been generated with:

schema {
  query: Query
  mutation: Mutation
  subscription: Subscription <-- DELETED
}

type Subscription {          <-- DELETED
  bookingsTopic: [Booking!]! <-- DELETED
}                            <-- DELETED

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

To encourage the use of gql Subscriptions with limited capabilities of the federated GQL services

@kamilmysliwiec
Copy link
Member

We could maintain this Subscription as a feature of the service, while essentially not informing the Gateway of it's existence since the SDL wouldn't have been generated with:

If it's not supposed to be exposed in the schema, why can't you just comment out the @Subscription decorator?

@bneigher
Copy link
Author

@kamilmysliwiec well, because I want to Subscription handler to be available when directly using the GQL API ☝️ ... but not federated into the Apollo Gateway when updating the generated SDL. I feel like my ask is more of an ability to remove things from the SDL when we printSchema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants