-
Notifications
You must be signed in to change notification settings - Fork 55
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
@key tests should verify existence of key directive definitions in SDL #144
Labels
type: bug
Something isn't working
Comments
dariuszkuc
added a commit
to dariuszkuc/apollo-federation-subgraph-compatibility
that referenced
this issue
Aug 11, 2022
Update `product` subgraph with additional entites to separate testing for various `@key` test cases. Previously we were testing single entity that was supposed to define multiple `@key` directives. This was problematic as not all implementations support repeatable directives and we never checked whether given `@key` test case was actually present in the schema (test was executing `_entities` query only). Schema changes (existing fields and types are omitted for clarity): ```graphql type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { # new field research: [ProductResearch!]! } type DeprecatedProduct @key(fields: "sku package") { sku: String! package: String! reason: String createdBy: User } type ProductResearch @key(fields: "study { caseNumber }") { study: CaseStudy! outcome: String } type CaseStudy { caseNumber: ID! description: String } extend type Query { # new query deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead") } ``` Update `@key` tests cases to verify: * single field `@key` functionality against `User` type * multiple field `@key` functionality against `DeprecatedProduct` type * composite object `@key` functionality against `ProductResearch` type * repeatable `@key` functionality against `Product` type (this test combines old tests into a single one) Related Issues: * resolves apollographql#144 * resolves apollographql#149
dariuszkuc
added a commit
to dariuszkuc/apollo-federation-subgraph-compatibility
that referenced
this issue
Aug 11, 2022
Update `product` subgraph with additional entites to separate testing for various `@key` test cases. Previously we were testing single entity that was supposed to define multiple `@key` directives. This was problematic as not all implementations support repeatable directives and we never checked whether given `@key` test case was actually present in the schema (test was executing `_entities` query only). Schema changes (existing fields and types are omitted for clarity): ```graphql type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { # new field research: [ProductResearch!]! } type DeprecatedProduct @key(fields: "sku package") { sku: String! package: String! reason: String createdBy: User } type ProductResearch @key(fields: "study { caseNumber }") { study: CaseStudy! outcome: String } type CaseStudy { caseNumber: ID! description: String } extend type Query { # new query deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead") } ``` Update `@key` tests cases to verify: * single field `@key` functionality against `User` type * multiple field `@key` functionality against `DeprecatedProduct` type * composite object `@key` functionality against `ProductResearch` type * repeatable `@key` functionality against `Product` type (this test combines old tests into a single one) Related Issues: * resolves apollographql#144 * resolves apollographql#149
dariuszkuc
added a commit
to dariuszkuc/apollo-federation-subgraph-compatibility
that referenced
this issue
Aug 11, 2022
Update `product` subgraph with additional entites to separate testing for various `@key` test cases. Previously we were testing single entity that was supposed to define multiple `@key` directives. This was problematic as not all implementations support repeatable directives and we never checked whether given `@key` test case was actually present in the schema (test was executing `_entities` query only). Schema changes (existing fields and types are omitted for clarity): ```graphql type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { # new field research: [ProductResearch!]! } type DeprecatedProduct @key(fields: "sku package") { sku: String! package: String! reason: String createdBy: User } type ProductResearch @key(fields: "study { caseNumber }") { study: CaseStudy! outcome: String } type CaseStudy { caseNumber: ID! description: String } extend type Query { # new query deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead") } ``` Update `@key` tests cases to verify: * single field `@key` functionality against `User` type * multiple field `@key` functionality against `DeprecatedProduct` type * composite object `@key` functionality against `ProductResearch` type * repeatable `@key` functionality against `Product` type (this test combines old tests into a single one) Related Issues: * resolves apollographql#144 * resolves apollographql#149
dariuszkuc
added a commit
that referenced
this issue
Aug 11, 2022
…165) Update `product` subgraph with additional entites to separate testing for various `@key` test cases. Previously we were testing single entity that was supposed to define multiple `@key` directives. This was problematic as not all implementations support repeatable directives and we never checked whether given `@key` test case was actually present in the schema (test was executing `_entities` query only). Schema changes (existing fields and types are omitted for clarity): ```graphql type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { # new field research: [ProductResearch!]! } type DeprecatedProduct @key(fields: "sku package") { sku: String! package: String! reason: String createdBy: User } type ProductResearch @key(fields: "study { caseNumber }") { study: CaseStudy! outcome: String } type CaseStudy { caseNumber: ID! description: String } extend type Query { # new query deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead") } ``` Update `@key` tests cases to verify: * single field `@key` functionality against `User` type * multiple field `@key` functionality against `DeprecatedProduct` type * composite object `@key` functionality against `ProductResearch` type * repeatable `@key` functionality against `Product` type (this test combines old tests into a single one) Related Issues: * resolves #144 * resolves #149
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently our tests execute
with various representations and verify we got some response. As long as implementing libraries have valid federated resolver that can handle various representations, then tests are marked as successful even though those
@key
definitions might not be present in the SDL.The text was updated successfully, but these errors were encountered: