-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #859 from apollographql/trevor/print-tag-inaccessi…
…ble-directives-conditionally fix(federation): Print @tag and @inaccessible directives conditionally
- Loading branch information
Showing
11 changed files
with
529 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...n-integration-testsuite-js/src/fixtures/special-cases/accountsWithoutTagOrInaccessible.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export { name, url, resolvers } from '../accounts'; | ||
export const typeDefs = gql` | ||
directive @stream on FIELD | ||
directive @transform(from: String!) on FIELD | ||
schema { | ||
query: RootQuery | ||
mutation: Mutation | ||
} | ||
extend type RootQuery { | ||
user(id: ID!): User | ||
me: User | ||
} | ||
type PasswordAccount @key(fields: "email") { | ||
email: String! | ||
} | ||
type SMSAccount @key(fields: "number") { | ||
number: String | ||
} | ||
union AccountType = PasswordAccount | SMSAccount | ||
type UserMetadata { | ||
name: String | ||
address: String | ||
description: String | ||
} | ||
type User @key(fields: "id") @key(fields: "username name { first last }") { | ||
id: ID! | ||
name: Name | ||
username: String | ||
birthDate(locale: String): String | ||
account: AccountType | ||
metadata: [UserMetadata] | ||
ssn: String | ||
} | ||
type Name { | ||
first: String | ||
last: String | ||
} | ||
type Mutation { | ||
login(username: String!, password: String!): User | ||
} | ||
extend type Library @key(fields: "id") { | ||
id: ID! @external | ||
name: String @external | ||
userAccount(id: ID! = "1"): User @requires(fields: "name") | ||
} | ||
`; |
2 changes: 1 addition & 1 deletion
2
...uite-js/src/fixtures/reviewsWithUpdate.ts → ...xtures/special-cases/reviewsWithUpdate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...on-integration-testsuite-js/src/fixtures/special-cases/reviewsWithoutTagOrInaccessible.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export { name, url, resolvers } from '../reviews'; | ||
export const typeDefs = gql` | ||
directive @stream on FIELD | ||
directive @transform(from: String!) on FIELD | ||
extend type Query { | ||
topReviews(first: Int = 5): [Review] | ||
} | ||
type Review @key(fields: "id") { | ||
id: ID! | ||
body(format: Boolean = false): String | ||
author: User @provides(fields: "username") | ||
product: Product | ||
metadata: [MetadataOrError] | ||
} | ||
input UpdateReviewInput { | ||
id: ID! | ||
body: String | ||
} | ||
extend type UserMetadata { | ||
address: String @external | ||
} | ||
extend type User @key(fields: "id") { | ||
id: ID! @external | ||
username: String @external | ||
reviews: [Review] | ||
numberOfReviews: Int! | ||
metadata: [UserMetadata] @external | ||
goodAddress: Boolean @requires(fields: "metadata { address }") | ||
} | ||
extend interface Product { | ||
reviews: [Review] | ||
} | ||
extend type Furniture implements Product @key(fields: "upc") { | ||
upc: String! @external | ||
reviews: [Review] | ||
} | ||
extend type Book implements Product @key(fields: "isbn") { | ||
isbn: String! @external | ||
reviews: [Review] | ||
similarBooks: [Book]! @external | ||
relatedReviews: [Review!]! @requires(fields: "similarBooks { isbn }") | ||
} | ||
extend interface Vehicle { | ||
retailPrice: String | ||
} | ||
extend type Car implements Vehicle @key(fields: "id") { | ||
id: String! @external | ||
price: String @external | ||
retailPrice: String @requires(fields: "price") | ||
} | ||
extend type Van implements Vehicle @key(fields: "id") { | ||
id: String! @external | ||
price: String @external | ||
retailPrice: String @requires(fields: "price") | ||
} | ||
extend type Mutation { | ||
reviewProduct(upc: String!, body: String!): Product | ||
updateReview(review: UpdateReviewInput!): Review | ||
deleteReview(id: ID!): Boolean | ||
} | ||
# Value type | ||
type KeyValue { | ||
key: String! | ||
value: String! | ||
} | ||
# Value type | ||
type Error { | ||
code: Int | ||
message: String | ||
} | ||
# Value type | ||
union MetadataOrError = KeyValue | Error | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.