Skip to content

InputTypes generated for Discriminators #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MatthewJonD opened this issue Apr 26, 2021 · 3 comments
Open

InputTypes generated for Discriminators #326

MatthewJonD opened this issue Apr 26, 2021 · 3 comments

Comments

@MatthewJonD
Copy link

May have missed the options....
But, for example, in using the CreateOne*Input type for the createOne resolver, the discriminatorKey field isnt included in the generated type.

So for the documentation example-
CharacterSchema.set('discriminatorKey', 'type');
The type field is not included in the CreateOneDroidInput
Is it possible to include it for the inputType?

@nodkz
Copy link
Member

nodkz commented May 5, 2021

You may add it manually:

CreateOneResolver.getArgITC('record').setField('type', 'String!');

graphql-compose allows modifying all generated types as you wish. Anyway, feel free to write your custom resolver if you met with a complex situation uncovered by a generator (composeMongoose()).

@MatthewJonD
Copy link
Author

Thanks. Will do.

BTW-
What was the thinking for not including? Just wondering if Im my implementation is crazy

@nodkz
Copy link
Member

nodkz commented May 16, 2021

Yep, it can be added but need to think about how it can be implemented. CharacterSchema.set('discriminatorKey', 'type'); added to mongoose schema without any hint about what exactly type is used for this field (string, int, float).

It will be nice if you have time to open Pull Request and propose your solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants