I have this combined typeDefs (allTypeDefs) file:
["@link(url: "https://specs.apollo.dev/federation/v2.3",
import: ["@key","@external"])
scalar Date
type Name {
first_name: String!
middle_name: String
last_name: String
}
type Safe @key(fields: "safe_id"){
safe_id: ID!
owner: User! # HAS_SAFE
wallets: [Wallet!]!
}
type User @key(fields: "user_id") {
user_id: ID!
email: String!
role: String!
permissions: [String!]!
created_at: Date!
updated_at: Date!
username: String
name: Name
safe: Safe!
}
input UpdateUserInput {
username: String!
email: String!
name: Name!
telephone: String!
role: String!
permissions: [String!]!
}
type Query {
getUser(username: String!): User!
getUsers: [User!]!
}
type Mutation {
createUser(input: CreateUserInput!): User!
updateUser(username: String!, input: UpdateUserInput!): User!
deleteUser(username: String!): User!
addRole(username: String!, role: String!): User!
addPermission(username: String!, permission: String!): User!
removeRole(username: String!, role: String!): User!
removePermission(username: String!, permission: String!): User!
}","type ApiKey {
api_name: String!
api_key: String!
}
type LoginResult {
user: User!
isAuthenticated: Boolean!
access_token: String
refreshToken: String
challenge: String
}
input ApiKeyInput {
app_name: String!
}
input CreateUserInput {
email: String!
username: String
password: String
name: Name
telephone: String
country: String;
}
input LoginUserInput {
email: String!
username: String
password: String
token: String
pubkey: String
}
input VerifyResponseInput {
create_user_input: CreateUserInput!
response: String!
}
extend type Query {
refreshToken: String!
}
extend type Mutation {
createApiKey( input: ApiKeyInput!): ApiKey!
login(input: LoginUserInput!): LoginResult!
verifyResponse(input: VerifyResponseInput!): LoginResult!
logout: Boolean!
}
"]
when i try to merge them using
mergeTypeDefs(allTypeDefs)
I am getting this syntax error:
/Applications/flash/flash-gateway/node_modules/graphql/error/syntaxError.js:15
return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, {
^
GraphQLError: Syntax Error: Unexpected "@".
at syntaxError (/Applications/flash/flash-gateway/node_modules/graphql/error/syntaxError.js:15:10)
at Parser.unexpected (/Applications/flash/flash-gateway/node_modules/graphql/language/parser.js:1458:41)
at Parser.parseDefinition (/Applications/flash/flash-gateway/node_modules/graphql/language/parser.js:212:16)
at Parser.many (/Applications/flash/flash-gateway/node_modules/graphql/language/parser.js:1511:26)
at Parser.parseDocument (/Applications/flash/flash-gateway/node_modules/graphql/language/parser.js:122:25)
at parse (/Applications/flash/flash-gateway/node_modules/graphql/language/parser.js:32:17)
at visitTypeSources (/Applications/flash/flash-gateway/node_modules/@graphql-tools/merge/cjs/typedefs-mergers/merge-typedefs.js:48:54)
at visitTypeSources (/Applications/flash/flash-gateway/node_modules/@graphql-tools/merge/cjs/typedefs-mergers/merge-typedefs.js:40:17)
at mergeGraphQLTypes (/Applications/flash/flash-gateway/node_modules/@graphql-tools/merge/cjs/typedefs-mergers/merge-typedefs.js:70:41)
at createTypeDefs (/Applications/flash/flash-gateway/dist/apps/auth/main.js:1907:42)
I am using @apollo/gateway 2.5.4 @apollo/server 4.9.3 and @apollo/subgraph 2.5.4 with Nestjs v9.4.2
my understanding is that mergeTypeDefs is compatible with these apollo directives. can anyone shed some light on this?