Skip to content

Commit

Permalink
[schema] Validate that type name is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Dec 15, 2017
1 parent 8d63d66 commit b0736b2
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export function validateTypeName(typeName: string, visitorContext) {
]
}

if (typeof typeName !== 'string') {
return [
error(`Type has an invalid "type"-property - should be a string. Valid types are: ${humanize(possibleTypeNames)}`,
HELP_IDS.TYPE_MISSING_TYPE)
]
}

const isValid = possibleTypeNames.includes(typeName)

if (!isValid) {
Expand Down

0 comments on commit b0736b2

Please sign in to comment.