VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

Attempting to implement multiple interfaces on a type causes an error #2727

Closed arctop-sk closed 2 years ago

arctop-sk commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Implementing multiple interfaces on a type in a collection is broken, due to wrong delimiter between interfaces.

To Reproduce Steps to reproduce the behavior: add 2 interfaces to a collection, build fails

Expected behavior type is built correctly

Source of the issue is likely here:

export const mainTypeTemplate = ({ typeName, description, interfaces, fields }) => ${description ?# ${description}: ''} type ${typeName} ${interfaces.length ?implements ${interfaces.join(', ')} : ''}{ ${convertToGraphQL(fields, ' ')} } ;

${interfaces.join(', ')} should be ${interfaces.join(' & ')}

As multiple interfaces are defined as such: type Business implements NamedEntity & ValuedEntity { name: String value: Int employeeCount: Int }

eric-burel commented 2 years ago

Yes you're right, could you please try to open a PR so that I can fix this as soon as possible? It may also happen in Vulcan NPM

eric-burel commented 2 years ago

Note that it seems that comma used to work in earlier version of graphql, but the & is the official syntax now

arctop-sk commented 2 years ago

https://github.com/VulcanJS/Vulcan/pull/2728