Comments (4)
New test requires extend type User
and doesn't allow for type User @extends
for libraries that don't support the extend
keyword
from apollo-federation-subgraph-compatibility.
Also looks like the ordering of the @key
directives also can cause the test to fail. e.g. My code first SDL generates
type Product @key(fields: "sku variation { id }") @key(fields: "sku package") @key(fields: "id")
but the test is looking for
type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }")
and so it fails even though these are syntactically equivalent
from apollo-federation-subgraph-compatibility.
Updated product
schema:
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.0",
import: [
"@extends",
"@external",
"@key",
"@inaccessible",
"@override",
"@provides",
"@requires",
"@shareable",
"@tag"
]
)
type Product
@key(fields: "id")
@key(fields: "sku package")
@key(fields: "sku variation { id }") {
id: ID!
sku: String
package: String
variation: ProductVariation
dimensions: ProductDimension
createdBy: User @provides(fields: "totalProductsCreated")
notes: String @tag(name: "internal")
research: [ProductResearch!]!
}
type DeprecatedProduct @key(fields: "sku package") {
sku: String!
package: String!
reason: String
createdBy: User
}
type ProductVariation {
id: ID!
}
type ProductResearch @key(fields: "study { caseNumber }") {
study: CaseStudy!
outcome: String
}
type CaseStudy {
caseNumber: ID!
description: String
}
type ProductDimension @shareable {
size: String
weight: Float
unit: String @inaccessible
}
extend type Query {
product(id: ID!): Product
deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead")
}
extend type User @key(fields: "email") {
averageProductsCreatedPerYear: Int @requires(fields: "totalProductsCreated yearsOfEmployment")
email: ID! @external
name: String @override(from: "users")
totalProductsCreated: Int @external
yearsOfEmployment: Int! @external
}
Test data:
const dimension = {
size: "small",
weight: 1,
unit: "kg"
};
const user = {
averageProductsCreatedPerYear: if (totalProductsCreated) {
Math.round(totalProductsCreated / yearsOfEmployment)
} else {
null
},
email: "support@apollographql.com",
name: "Jane Smith",
totalProductsCreated: 1337,
yearsOfEmployment: 10
};
const deprecatedProduct = {
sku: "apollo-federation-v1",
package: "@apollo/federation-v1",
reason: "Migrate to Federation V2",
createdBy: user
};
const productsResearch = [
{
study: {
caseNumber: "1234",
description: "Federation Study"
},
outcome: null
},
{
study: {
caseNumber: "1235",
description: "Studio Study"
},
outcome: null
},
];
const products = [
{
id: "apollo-federation",
sku: "federation",
package: "@apollo/federation",
variation: {
id: "OSS"
},
dimensions: dimension,
research: [productsResearch[0]]
createdBy: user,
notes: null
},
{
id: "apollo-studio",
sku: "studio",
package: "",
variation: {
id: "platform"
},
dimensions: dimension,
research: [productsResearch[1]]
createdBy: user,
notes: null
},
];
from apollo-federation-subgraph-compatibility.
Thanks for catching those! I fixed the tests in #169 and #170 (you might need to rebase the PR).
from apollo-federation-subgraph-compatibility.
Related Issues (20)
- No tests found when using fedtest with pnpm HOT 2
- Caliban `@tag` compatibility tests incomplete
- AWS AppSync compatibility tests are broken HOT 6
- Rename PHP implementation to Skillshare library
- old renovate Dependency Dashboard HOT 1
- As a subgraph library maintainer, how should I test enterprise features?
- As a subgraph library maintainer, how do I test subscriptions?
- As a subgraph library maintainer, how do I test `@authenticated` directive?
- Found Invalid Compatibility Test Results HOT 1
- `--failOnRequired`/`--failOnWarning` interact in surprising way HOT 1
- Dependency Dashboard
- build: allow libs to specify separate build step to speed up compatibility tests
- bug: fix comment workflow for hosted/other solutions
- bug: update all workflows to use their defined/generated schemas instead of using template one
- feat: pretty print generated tables in markdown results
- Support for Federaton 2.5 and 2.6 HOT 1
- update AWS AppSync keys HOT 5
- fix Grafbase integration
- Invalid target 'x86_64-apple-darwin' for 'router' binary, target for router v1.39.1 or later.
- subgraphs are not valid/composable? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-federation-subgraph-compatibility.