Skip to content

Commit

Permalink
Allow arrays with more than one file path & ignore empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Jan 18, 2018
1 parent 9d3173b commit 14ae101
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/gatsby/src/schema/infer-graphql-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,12 @@ export function inferObjectStructureFromNodes({
// pointing to a file (from another file).
} else if (
nodes[0].internal.type !== `File` &&
((_.isString(value) && shouldInferFile(nodes, nextSelector, value)) ||
((_.isString(value) &&
!_.isEmpty(value) &&
shouldInferFile(nodes, nextSelector, value)) ||
(_.isArray(value) &&
value.length === 1 &&
_.isString(value[0]) &&
!_.isEmpty(value[0]) &&
shouldInferFile(nodes, `${nextSelector}[0]`, value[0])))
) {
inferredField = inferFromUri(key, types, _.isArray(value))
Expand Down

0 comments on commit 14ae101

Please sign in to comment.