fix: updates types to match new schema #697
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #696
Situation
When we first set up builds for
rover-client
, we were manually downloading the schema and committing it periodically to the repo. Unfortunately, this was creating 7k line diffs on most PRs just from the schema changes, and it wasn't automated. This was a pain! From there, we added the schema to our.gitignore
and started downloading the schema automatically if the builder was connected to the internet. We then set up an escape hatch for if we ever wanted to substitute a different schema at compile time. (APOLLO_GRAPHQL_SCHEMA_URL
).Due to recent breaking changes in Apollo's GraphQL schema (which shouldn't actually cause issues with Rover aside from codegen), we want to start using
APOLLO_GRAPHQL_SCHEMA_URL
to build Rover with a schema that plays nicely with the types from old versions.Problem
Unfortunately, we never tested that using
std::env::var
would work properly inbuild.rs
files, and... it turns out they don't. There is a significant difference between theoption_env!
macro, which checks for environment variables at compile time, andstd::env::var
(which is what we were using up until this PR). That means thatAPOLLO_GRAPHQL_SCHEMA_URL
is neverResolution
This PR does a few things:
--version
parameter forcargo xtask dist
that will go fetch that schema from the GitHub releases API if the automatically downloaded schema fails to build. It does this by cloning the repo into a temp directory, attempting to build once, and when it inevitably fails, it downloads the schema from the version's GitHub release assets and replaces the one it downloaded automatically from Apollo.APOLLO_GRAPHQL_SCHEMA_URL
environment variable is actually supported, socargo xtask install --version
whereversion >= v0.2.0.beta.1
will go straight to GitHub releases to download the schema and we won't have to build twice.Additionally this PR updates the version of rover on
main
to handle the new non-nullable field that broke our codegen.