It doesn't look like "@apollo/federation": "^0.11.2" and "@apollo/gateway": "^0.11.5" support custom scalars。
The gateway can identify custom type fields defined by child services。
GraphQLSchemaValidationError: [micro-test2] User.id -> Type
undefineddoes not match the type of the original field in micro-test (UserId)
#### micro-test
type User @key(fields: "id"){
id: UserId!
username:String
}
new GraphQLScalarType({
name: 'UserId',
description: 'Global id of User Schema',
serialize(value) {
// value sent to the client
return toGlobalId('User', value)
},
parseValue(value) {
// value from the client
if (typeof value === 'string') {
const { type, id } = fromGlobalId(value)
if (type === typeName) {
return id
}
throw new Error('Incorrect globalId type: ' + type)
} else {
throw new Error('Incorrect globalId format: ')
}
},
parseLiteral(ast) {
// more
}
})
#### micro-test2
extend type User @key(fields: "id"){
id: UserId! @external
realName: String
}
When I start the gateway , it unable to start normally and throw error(It seems that you don't know what userId is in service micro-test2. Even if I try to define the same userId).If I use ID to replace custom ID, the entire service can work.How can I solve this problem?Thanks.
Sorry, it's my fault.
What was the solution?