-
Notifications
You must be signed in to change notification settings - Fork 731
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
Add handling for downloading schema from registry to Swift Scripting #1691
Conversation
…ugh the registry or via introspection
…ed without breaking the enum in the future.
/// - endpointURL: The endpoint to hit to download your schema. | ||
case introspection(endpointURL: URL) | ||
|
||
public struct RegistrySettings: Equatable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a separate object so that it can have new parameters added without breaking the enum.
outputFolderURL: output) | ||
|
||
// Registry download: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is left commented out for end to end testing in the future - not a great way to end to end test this without setting up a whole way of getting secrets into the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/// | ||
/// - Parameters: | ||
/// - apiKey: The API key to use when retrieving your schema. | ||
/// - graphID: The identifier of the graph to fetch. Can be found in Apollo Studio. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's nothing explicitly named "graph id" in Apollo Studio that I can see, but I'm guessing it's the dynamic part of the URL (after "/graph/"). If so, this is also the part between "service:" and the key itself in the token.
I've changed the name of our graph in Apollo Studio, but the name in the URL and token retains the old name so I'm guessing the "graph id" is the full thing and not just the id-looking part after the old name. I'll give it a shot and see what works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thoughts above were accurate, and it works 👍 An internet-savvy person can probably figure it out, but it's not entirely obvious what to put as the graphID
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's being addressed on the Studio end shortly.
Our wrapper for downloading a schema has been limited to downloading from introspection endpoints without me realizing it. This PR updates our
SchemaOptions
to allow setup of download from the registry, which is supported by the underlying CLI.This is a breaking change since I've broken up introspection vs registry download into an enum (since data required for each is mutually exclusive), and changed the name of the parameter that information must be handed to.
Addresses #1690.