Skip to content

Commit

Permalink
Merge pull request #2375 from CarsonF/bugfix/interface-of-interface-r…
Browse files Browse the repository at this point in the history
…esolver

fix(): Merge in parent interface fields to interfaces
  • Loading branch information
kamilmysliwiec committed Sep 1, 2022
2 parents 43e5420 + 1c7da39 commit 691e3f3
Showing 1 changed file with 16 additions and 1 deletion.
Expand Up @@ -113,7 +113,22 @@ export class InterfaceDefinitionFactory {

return () => {
let fields: GraphQLFieldConfigMap<any, any> = {};
metadata.properties.forEach((field) => {

let properties = [];
if (metadata.interfaces) {
const implementedInterfaces =
TypeMetadataStorage.getInterfacesMetadata()
.filter((it) =>
getInterfacesArray(metadata.interfaces).includes(it.target),
)
.map((it) => it.properties);
implementedInterfaces.forEach((fields) =>
properties.push(...(fields || [])),
);
}
properties = properties.concat(metadata.properties);

properties.forEach((field) => {
const type = this.outputTypeFactory.create(
field.name,
field.typeFn(),
Expand Down

0 comments on commit 691e3f3

Please sign in to comment.