mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

Change the default name of Date scalar #701

Closed Israel-Or closed 3 years ago

Israel-Or commented 3 years ago

I'm using this library to generate my sequlize model into graphql, the issue is that I'm using another library to generate my mongoose model, both libraries creates new scalar time called Date, and the graphql is throwing me an error: Schema must contain uniquely named types but contains multiple types named “Date”. Any chance to add the ability to choose the name for this scalar? Thanks!

mickhansen commented 3 years ago

You could probably monkey patch https://github.com/mickhansen/graphql-sequelize/blob/master/src/types/dateType.js to change the name.

Or you could exclude the fields and define the type yourself.

Israel-Or commented 3 years ago

You could probably monkey patch https://github.com/mickhansen/graphql-sequelize/blob/master/src/types/dateType.js to change the name.

Or you could exclude the fields and define the type yourself.

Thank for the quick replay, how can I exclude the fields? @mickhansen

mickhansen commented 3 years ago

attributeFields takes an exclude option: https://github.com/mickhansen/graphql-sequelize/blob/master/src/attributeFields.js#L8