-
Notifications
You must be signed in to change notification settings - Fork 257
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
fix(gateway): Make protected
fields and methods private
(except loadServiceDefinitions
)
#539
Conversation
2952111
to
5241170
Compare
protected
fields private
protected
fields and methods private
94a65d4
to
01448e6
Compare
protected
fields and methods private
protected
fields and methods private
(except loadServiceDefinitions
)
protected
fields and methods private
(except loadServiceDefinitions
)protected
fields and methods private
(except loadServiceDefinitions
)
We reach into the |
Hey @williamboman-pp, thanks for letting us know. I'm glad this has worked for you up to this point, but I don't think we want to encourage the pattern of mutating the I'd like to know your thoughts on an API improvement I have in mind for this, and if this solves the need for you. |
We (Khan Academy) are using:
As you can see we definitely know that calling these methods is reaching into internals a little, so it's not the end of the world if we can't do it without private methods. But seeing it in the changelog I wanted to mention it here so you can get an idea of what wild and strange things people are doing and why! |
One answer for overriding |
Ah, will that work? I guess it wasn't obvious to me that the only use of the URL was to pass it through to the GraphQLDataSource. I'll it a try -- it will be simpler than what I did instead! |
This is actually what I tried to simulate an API for (making it possible to provide a function) by subclassing I'm all for it 👍! The only thing that comes to mind in terms of which function args that could be interesting is which data source is being introspected. Not that we particularly need this though, but I can see use cases with having to provide different headers depending on the data source (and also for logging purposes). |
Hey @williamboman-pp, sorry I've left this hanging. I'm not sure when I'll reasonably be able to prioritize this work, though I'd definitely entertain a PR if you felt so inclined. I've opened an issue #604 for tracking this - it's something I would hope to get to eventually if you're unable to or if it's not a high priority. |
Looks like |
Howdy @dakshas! it was removed in #1371. Depending on what you were doing in federation/gateway-js/src/index.ts Lines 662 to 673 in 7c1c28a
Lemme know if that's what you were looking for. Feel free to open up an issue if you're not able to find what you need. |
Hi folks, finally got back to this. Is there a native way to do this now ? It looks like supergraphSdl continues to only supports "managed" or "unmanged mode" https://www.apollographql.com/docs/federation/api/apollo-gateway/#supergraphsdl
|
I think you'd want to provide your own |
@benweatherman Earlier I was pulling in the managed and unmanged schemas as Is writing my own SupergraphManager the only way to achieve this functionality going forward ? let me know if you have any suggestions for achieving this functionality. |
Without a strong case for subclassing the gateway, keeping these fields and methods as
protected
is more confusing than useful (is there a use case for subclassing?...one might ask). We don't believe so, but feel free to @ me on this PR if this breaking change voids a legitimate use case that can't be accomplished via the gateway's configuration.Edit: a use case for
loadServiceDefinitions
to be overridden has been brought to my attention, so I'm going to leave this asprotected
. For future consideration, we may want to expose this desired capability more cleanly via the gateway's configuration.There is almost parity between the
experimental_updateServiceDefinitions
config option and overridingloadServiceDefinitions
, however the hook doesn't allow the user to call the original implementation ofloadServiceDefinitions
(which is one existing use case that we would be breaking).