I have 3 graphql services that i want to federate together.
2 of them are neo4j based and 1 is a graphql wrapper around a REST endpoint.
I was able to federate 1 neo4j and the REST one using the @shareable and @key directive in neo4j one.
But when I tried to include the other neo4j service I received this error from the graphql library :
Neo4jGraphQLSchemaValidationError: @key unrecognized arguments: operations
at /app/node_modules/@neo4j/graphql/dist/schema-model/parser/key-annotation.js:14:19
at Array.forEach (<anonymous>)
at parseKeyAnnotation (/app/node_modules/@neo4j/graphql/dist/schema-model/parser/key-annotation.js:9:16)
at createEntityAnnotations (/app/node_modules/@neo4j/graphql/dist/schema-model/generate-
model.js:210:72)
at generateConcreteEntity (/app/node_modules/@neo4j/graphql/dist/schema-model/generate-model.js:158:22)
at Array.map (<anonymous>)
at generateModel (/app/node_modules/@neo4j/graphql/dist/schema-model/generate-model.js:26:58)
at Neo4jGraphQL.generateSubgraphSchema (/app/node_modules/@neo4j/graphql/dist/classes/Neo4jGraphQL.js:279:67)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
I noticed this comes whenever I use the @key directive in the schema, which is this :
extend schema @link(url: "https://specs.apollo.dev/federation/v2.0",
import: ["@key", "@shareable"])
type PATENT @exclude(operations: [CREATE, DELETE, UPDATE]) @shareable @key(fields: "app_num") {
app_num: String!
hasAssignmentassignments: [ASSIGNMENT!]! @relationship(type: "HAS_ASSIGNMENT", direction: OUT)
}
type ASSIGNEE @exclude(operations: [CREATE, DELETE, UPDATE]) {
address: String
city: String
country: String
isAssigneeOfassignments: [ASSIGNMENT!]! @relationship(type: "IS_ASSIGNEE_OF", direction: OUT)
name: String
postcode: String
state: String
}
type ASSIGNMENT @exclude(operations: [CREATE, DELETE, UPDATE]) {
assigneesisAssigneeOf: [ASSIGNEE!]! @relationship(type: "IS_ASSIGNEE_OF", direction: IN)
assignorsisAssignorOf: [ASSIGNOR!]! @relationship(type: "IS_ASSIGNOR_OF", direction: IN, properties: "IsAssignorOfProperties")
conveyance_text: String
correspondent: String
correspondent_address: String
country: String
frame_no: String!
id: String!
patentshasAssignment: [PATENT!]! @relationship(type: "HAS_ASSIGNMENT", direction: IN)
recorded_date: String!
reel_no: String!
}
type ASSIGNOR @exclude(operations: [CREATE, DELETE, UPDATE]) {
isAssignorOfassignments: [ASSIGNMENT!]! @relationship(type: "IS_ASSIGNOR_OF", direction: OUT, properties: "IsAssignorOfProperties")
name: String!
}
interface IsAssignorOfProperties @relationshipProperties {
execution_date: String
}
also I wanted to mention that this exact same thing works in the other neo4j API which is this (only the PATENT part) :
type PATENT @exclude(operations: [CREATE, DELETE, UPDATE]) @key(fields : "app_num") @key(fields: "patent_no") @shareable {
actual_disposal_type: String
aia: String
app_num: String!
app_status: String
app_status_date: String
attorney_docket_no: String
confirmation_no: String
disposal_type: String
entity_status: String
filing_date: String
issue_date: String
location: String
patent_no: String
publication_date: String
publication_no: String
title: String
usc_class: String
usc_subclass: String
has_applicants: [APPLICANT!]! @relationship(type: "IS_APPLICANT_OF", direction: IN)
has_attorneys: [ATTORNEY!]! @relationship(type: "IS_ASSOCIATED_TO_PATENT", direction: IN)
has_examiner: [EXAMINER!]! @relationship(type: "EXAMINED", direction: IN)
has_law_firm: [LAW_FIRM!]! @relationship(type: "IS_ASSOCIATED_TO", direction: IN)
has_continuities: [CONTINUITY_DATA!]! @relationship(type: "HAS_CONTINUITY", direction: OUT)
has_file_history : [FILE_NODE!]! @relationship(type: "HAS_FILE", direction: OUT)
has_gau : [GAU!]! @relationship(type: "HAS_GAU", direction: OUT)
has_priority_claims : [PRIORITY_CLAIM!]! @relationship(type: "HAS_PRIORITY_CLAIM", direction: OUT)
has_prosecutions: [PROSECUTION_NODE!]! @relationship(type: "HAS_PROSECUTION", direction: OUT)
has_term_adjustments: [TERM_ADJUSTMENTS!]! @relationship(type: "HAS_TERM_ADJUSTMENTS", direction: OUT)
has_inventors: [INVENTOR!]! @relationship(type: "INVENTED", direction: IN)
has_application_type: [APP_TYPE!]! @relationship(type: "IS_OF_TYPE", direction: OUT)
has_parents: [PATENT!]! @relationship(type: "IS_PARENT_OF", direction: IN, properties: "IsParentOfProperties")
has_children: [PATENT!]! @relationship(type: "IS_PARENT_OF", direction: OUT, properties: "IsParentOfProperties")
}
Can anyone please tell what is wrong with this ??
Best Regards,
Aman