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

Add gateway version to schema extensions #1751

Merged
merged 6 commits into from
Apr 22, 2022

Conversation

benweatherman
Copy link
Contributor

@benweatherman benweatherman commented Apr 20, 2022

Adds gateway version as a schema extension

TODO

  • Add typing info similar to the __resolveReference PR
  • Add tests
  • Figure out why we're still getting type errors during tests [this was happening because types were being excluded from compilation, fixed with 697bf88]
  • Change uses of require("package.json") to the newly generated version file Decided against this because we would still need to import package.json to get the name

Fixes #1749

@netlify
Copy link

netlify bot commented Apr 20, 2022

Deploy Preview for apollo-federation-docs ready!

Name Link
🔨 Latest commit 54b2151
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/6263015ff8b9c80008f63979
😎 Deploy Preview https://deploy-preview-1751--apollo-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 20, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

- Added as an external file, possibly keeping inline with the existing code style for  modifying schemas in the gateway
- Added `genversion` so we could keep an updated version string in the gateway code without importing `package.json` directly (which has various problems, including importing the whole file and how to import the file in typescript from the root of the sub-package).

## TODO
- [ ] Add typing info similar to the `__resolveReference` PR
- [ ] Add tests

Fixes #1749
@benweatherman benweatherman force-pushed the weatherman/gateway-federation-extensions branch from 392a85b to 1be54a2 Compare April 20, 2022 22:32
This standardizes using the `apollo.gateway` key structure for extensions and will make the typescript compiler happy
There are lots of places we use both `version` & `name` from the package file. There don't seem to be good solutions for pulling generic stuff out of the package file and I don't really want to create my own script, so I'm sticking with the existing pattern of reading the package file.
@benweatherman benweatherman marked this pull request as ready for review April 21, 2022 18:05
Copy link
Member

@trevor-scheer trevor-scheer left a comment

Choose a reason for hiding this comment

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

LGTM. I do think having to add the typings file to the test tsconfig is curious and likely symptomatic of some bad config somewhere, but I'm not sure what and I'm perfectly comfortable moving forward with this as-is.

Worth noting this doesn't need a backport because fed1 gateway schema objects are identifiable whereas fed2 gateway schema objects have no metadata (that I'm aware of) to make them identifiable.

@benweatherman benweatherman merged commit e47090a into main Apr 22, 2022
@benweatherman benweatherman deleted the weatherman/gateway-federation-extensions branch April 22, 2022 19:42
benweatherman added a commit that referenced this pull request Apr 25, 2022
# [2.0.2-alpha.0] - 2022-04-22

## 🚀 Features

- Improve fed1 schema support during composition [PR #1735](#1735)
- Add gateway version to schema extensions [PR #1751](#1751)

## 🐛 Fixes

- Improve merging of groups during `@require` handling in query planning [PR #1732](#1732)
- Move `__resolveReference` resolvers on to `extensions` [PR #1746](#1746)
- Honor directive imports when directive name is spec name [PR #1720](#1720)

## 🛠 Maintenance

- Improved renovate bot auto-updates for 0.x packages [PR #1736](#1736) and [PR #1730](#1730)
- Add missing `@apollo/federation-internals` dependency to gateway [PR #1721](#1721)
- Migrate to `@apollo/utils` packages for `createSHA` and `isNodeLike` [PR #1765](#1765)

## 📚 Documentation

- Roadmap updates! [PR #1717](#1717)
- Clarify separation of concerns in the intro docs [PR #1753](#1753)
- Update intro example for fed2 [PR #1741](#1741)
- Improve error doc generation, add hints generation, add scrolling style to too-large error tables [PR #1740](#1740)
- Update `supergraphSDL` to be a string when creating an `ApolloGateway` [PR #1744](#1744)
- Federation subgraph library compatibility updates [PR #1718](#1744)
@benweatherman benweatherman mentioned this pull request May 3, 2022
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.

Add schema extension to gateway schemas to differentiate federated schemas
2 participants