Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/pylon-dev/src/builder/schema/schema-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,20 @@ export class SchemaParser {
if (!derivedSchemaType.implements.includes(interfaceName)) {
derivedSchemaType.implements.push(interfaceName)
}

// Ensure the derived type includes all interface fields.
// Without this, GraphQL schema validation fails:
// "Interface field IFoo.x expected but Bar does not provide it."
if (targetInterface) {
for (const ifaceField of targetInterface.fields) {
const alreadyHasField = derivedSchemaType.fields.some(
f => f.name === ifaceField.name
)
if (!alreadyHasField) {
derivedSchemaType.fields.push({...ifaceField})
}
}
}
}

// Check if this derived type is also a base type for other types
Expand Down