Say I have this:
type Page {
id: ID!
title: String!
body: String!
comments: [Comment]
}
type Comment {
id: ID!
text: String!
someOtherField: String!
optional: String
}
mutation AddPage (input: AddPageInput): Page!
input AddPageInput {
title: String!
body: String
comment: AddPageCommentInput
}
input AddPageCommentInput {
text: String!
someOtherField: String!
optional: String
}
mutation AddComment (input: AddCommentInput): Comment!
input AddCommentInput {
forPageId: ID!
text: String!
someOtherField: String!
optional: String
}
I would like to deduplicate that AddPageCommentInput as it has the same fields as AddCommentInput except forPageId.
What I'm trying to do is to get the AddPage resolver to just delegate the AddPageCommentInput to AddComment resolver (after saving the Page and extending the input with forPageId)
Is the inheritance (with manually typing the definitions) the only way to make sure things are consistent ?
edit I don't have these types, it is just an attempt to provide context for the problem.
A better worded question is : "what options do I have to mimic inheritance for input ?"