Skip to content

Commit

Permalink
chore(federation): Update schema printers (#996)
Browse files Browse the repository at this point in the history
Update our subgraph and supergraph schema printers to match the printSchema
function from graphql-js as closely as possible. This introduces printing capabilities
for the @SpecifiedBy directive as well as @deprecated on input values.
  • Loading branch information
trevor-scheer committed Sep 3, 2021
1 parent 71e0dd1 commit 0f7f5c3
Show file tree
Hide file tree
Showing 7 changed files with 277 additions and 300 deletions.
8 changes: 7 additions & 1 deletion federation-integration-testsuite-js/src/fixtures/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const typeDefs = gql`
inheritMaxAge: Boolean
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION
scalar JSON @specifiedBy(url: "https://json-spec.dev")
schema {
query: RootQuery
mutation: Mutation
Expand Down Expand Up @@ -65,7 +67,11 @@ export const typeDefs = gql`
}
type Mutation {
login(username: String!, password: String!): User
login(
username: String!
password: String!
userId: String @deprecated(reason: "Use username instead")
): User
}
extend type Library @key(fields: "id") {
Expand Down
1 change: 1 addition & 0 deletions federation-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
> The changes noted within this `vNEXT` section have not been released yet. New PRs and commits which introduce changes should include an entry in this `vNEXT` section as part of their development. When a release is being prepared, a new header will be (manually) created below and the appropriate changes within that release will be moved into the new section.
- Remove composition responsibilities from supergraph printer. Fix schema sorting for sub- and super-graphs. [PR #1000](https://github.com/apollographql/federation/pull/1000)
- Update our subgraph and supergraph schema printers to match the printSchema function from graphql-js as closely as possible. Introduce printing capabilities for the @specifiedBy directive as well as @deprecated on input values. [PR #996](https://github.com/apollographql/federation/pull/996)

## v0.30.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe('printSubgraphSchema', () => {
PRIVATE
}
scalar JSON @specifiedBy(url: \\"https://json-spec.dev\\")
type PasswordAccount @key(fields: \\"email\\") {
email: String!
}
Expand Down Expand Up @@ -54,7 +56,7 @@ describe('printSubgraphSchema', () => {
}
type Mutation {
login(username: String!, password: String!): User
login(username: String!, password: String!, userId: String @deprecated(reason: \\"Use username instead\\")): User
}
extend type RootQuery {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ describe('printSupergraphSdl', () => {
url: String!
}
scalar JSON @specifiedBy(url: \\"https://json-spec.dev\\")
type KeyValue {
key: String!
value: String!
Expand All @@ -160,7 +162,7 @@ describe('printSupergraphSdl', () => {
type Mutation {
deleteReview(id: ID!): Boolean @join__field(graph: REVIEWS)
login(password: String!, username: String!): User @join__field(graph: ACCOUNTS)
login(password: String!, userId: String @deprecated(reason: \\"Use username instead\\"), username: String!): User @join__field(graph: ACCOUNTS)
reviewProduct(body: String!, upc: String!): Product @join__field(graph: REVIEWS)
updateReview(review: UpdateReviewInput!): Review @join__field(graph: REVIEWS)
}
Expand Down

0 comments on commit 0f7f5c3

Please sign in to comment.