Skip to content

Commit f64a9e0

Browse files
stefanprobstsidharthachatterjee
authored andcommitted
fix(gatsby): Add error message for field extension validation (#16232)
1 parent 6d8b663 commit f64a9e0

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/gatsby/src/schema/infer/__tests__/merge-types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ describe(`merges explicit and inferred type definitions`, () => {
588588
links: {
589589
type: `[Test!]!`,
590590
extensions: {
591-
link: true,
591+
link: {},
592592
},
593593
},
594594
},

packages/gatsby/src/schema/schema.js

+9
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,15 @@ const addExtensions = ({
392392
.filter(name => !internalExtensionNames.includes(name))
393393
.forEach(name => {
394394
const args = fieldExtensions[name]
395+
396+
if (!args || typeof args !== `object`) {
397+
report.error(
398+
`Field extension arguments must be provided as an object. ` +
399+
`Received "${args}" on \`${typeName}.${fieldName}\`.`
400+
)
401+
return
402+
}
403+
395404
try {
396405
const definition = schemaComposer.getDirective(name)
397406

0 commit comments

Comments
 (0)