You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the interface GqlModuleOptions, the typeDefs property is inherited from the apollo-server Config interface, which defines it as typeDefs?: DocumentNode | Array<DocumentNode>;
However, when I pass a DocumentNode as the value of typeDefs, I get the following error:
[Nest] 15752 - 2018-9-3 16:43:12 [ExceptionHandler] Syntax Error: Unexpected [ +102ms
Syntax Error: Unexpected [
GraphQL request (5:2)
4: }
5: ,[object Object]
^
6:
at syntaxError (C:\Development\vendure\vendure\server\node_modules\graphql\error\syntaxError.js:24:10)
at unexpected (C:\Development\vendure\vendure\server\node_modules\graphql\language\parser.js:1485:33)
at parseDefinition (C:\Development\vendure\vendure\server\node_modules\graphql\language\parser.js:160:9)
at parseDocument (C:\Development\vendure\vendure\server\node_modules\graphql\language\parser.js:115:22)
at parse (C:\Development\vendure\vendure\server\node_modules\graphql\language\parser.js:48:10)
at parseDocument (C:\Development\vendure\vendure\server\node_modules\graphql-tag\src\index.js:129:16)
at Object.gql (C:\Development\vendure\vendure\server\node_modules\graphql-tag\src\index.js:170:10)
at GraphQLFactory.mergeOptions (C:\Development\vendure\vendure\server\node_modules\@nestjs\graphql\dist\graphql.factory.js:32:55)
at Function.<anonymous> (C:\Development\vendure\vendure\server\node_modules\@nestjs\graphql\dist\graphql.module.js:73:55)
at Generator.next (<anonymous>)
Passing a string representation of the schema on the other hand works, but then I need to cast the string to any to avoid type errors.
This line in the GraphQLFactory class seems to be the point that the value is used as a string (or array of strings to be exact):
I'm submitting a...
Current behavior
In the interface
GqlModuleOptions
, thetypeDefs
property is inherited from the apollo-serverConfig
interface, which defines it astypeDefs?: DocumentNode | Array<DocumentNode>;
However, when I pass a DocumentNode as the value of
typeDefs
, I get the following error:Passing a string representation of the schema on the other hand works, but then I need to cast the string to
any
to avoid type errors.This line in the
GraphQLFactory
class seems to be the point that the value is used as a string (or array of strings to be exact):graphql/lib/graphql.factory.ts
Lines 32 to 34 in b58d3e5
Expected behavior
Either the GraphQLFactory should perform a check to see if the
typeDefs
is a DocumentNode, and if so then skip thegql
tag call.Or just change the
GqlModuleOptions
to make typeDefs a string type.Environment
The text was updated successfully, but these errors were encountered: