prisma-korea / graphql-schema-generator

Generate GraphQL Schema from Prisma schema.
MIT License
32 stars 12 forks source link

Custom rules overrides instead of extending #50

Open Akumzy opened 2 years ago

Akumzy commented 2 years ago

Hi all, Couple of days now I have been extending this package to support generating a valid where argument that maps to Prisma where filter My fork but I have bumped into issues with the test based on how things currently work.

For example the by adding CustomRules you've automatically overridden the package defined modifiers which are very important too.

I'm suggesting that CustomRules should only extend instead of overriding.

yujonglee commented 2 years ago

Sorry for the late response. I was quite bussy doing other works.

Thanks for the suggestion. It is true that extending is much cleaner, and actually that is what I was doing in the first place. However, I found that extending the existing rules can effects existing rules behavior. (I am trying to remember good example.)

So override the result of existing rules is more predictable.

And for your usecase, since we have beforeAddingTypeModifiers and afterAddingTypeModifiers, you can override scalar conversion without messing adding type modifiers. (with beforeAddingTypeModifiers).

If you are still curious or I didn't get your point, please provide some detailed example.

I agree that current design is quiet messy. We'll fix this. (Suggestions welcomed.)