Skip to content

Add handling for downloading schema from registry to Swift Scripting#1691

Merged
designatednerd merged 4 commits intomainfrom
fix/schema-from-registry
Mar 2, 2021
Merged

Add handling for downloading schema from registry to Swift Scripting#1691
designatednerd merged 4 commits intomainfrom
fix/schema-from-registry

Conversation

@designatednerd
Copy link
Copy Markdown
Contributor

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.

/// - endpointURL: The endpoint to hit to download your schema.
case introspection(endpointURL: URL)

public struct RegistrySettings: Equatable {
Copy link
Copy Markdown
Contributor Author

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.

downloadMethod: .introspection(endpointURL: endpoint),
outputFolderURL: output)

// Registry download:
Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

@AnthonyMDev AnthonyMDev left a comment

Choose a reason for hiding this comment

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

LGTM!

@designatednerd designatednerd merged commit 860c0ac into main Mar 2, 2021
///
/// - 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.
Copy link
Copy Markdown
Contributor

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!

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@designatednerd designatednerd deleted the fix/schema-from-registry branch March 3, 2021 20:34
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.

Downloading schema from Apollo Studio without introspection is not supported for Swift Scripting setup

3 participants