Apollo Federation - Duplicate scalar in multiple services
See original GitHub issue-
I run into an error when using a scalar like
DateTime
in two different microservices, and merging them together with Apollo Federation. Here is a snippet of the error being thrownUnhandledPromiseRejectionWarning: GraphQLSchemaValidationError: There can be only one type named "DateTime".
-
Apollo Federation
-
UnhandledPromiseRejectionWarning: GraphQLSchemaValidationError: There can be only one type named "DateTime"..
Microservice Foo
export const typeDefsFoo: DocumentNode = gql`
scalar DateTime
extend type Query {
foo(id: ID!): Sensor!
}
type Foo {
time: DateTime!
}
Microservice Bar
export const typeDefsBar: DocumentNode = gql`
scalar DateTime
extend type Query {
bar(id: ID!): Bar!
}
type Bar {
time: DateTime!
}
`;
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:17 (5 by maintainers)
Top Results From Across the Web
Value types in Apollo Federation - Apollo GraphQL Docs
This article describes how to share value types and their fields in federated graph, enabling multiple subgraphs to define and resolve them. Sharing...
Read more >Federated schema design best practices - Apollo GraphQL Docs
The majority of best practices that apply to non-federated GraphQL schema design also apply when designing service schemas within a federated graph.
Read more >Apollo Federation subgraph specification
This scalar is serialized as a generic JSON object, which enables the graph router to include representations of different entities in the same...
Read more >Custom scalars - Apollo GraphQL Docs
The GraphQL specification includes default scalar types Int , Float , String ... Copy. You can now use MyCustomScalar in your schema anywhere...
Read more >Value types - Apollo GraphQL Docs
Define the exact same type in multiple services · Scalars · Objects · Interfaces · Inputs · Enums · Unions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@byrnedo This should be available now in
@apollo/federation@0.6.4
.@apollo/gateway@0.6.7
should be published in the next couple hours with this@Pruxis I’m not aware of a workaround, but I hope to be wrapping up work on this today, so this should work soon. Sorry for the trouble. If anyone else here has a workaround, feel free to share!