[go: nahoru, domu]

Skip to content
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

Option to opt-out of "One" suffix for generated create/update/delete mutations (v 0.21.0) #306

Open
mdesousa opened this issue Jul 11, 2022 · 6 comments
Assignees
Labels
community Something initiated by the community enhancement New feature or request priority:high This issue is important and will be done first

Comments

@mdesousa
Copy link

Is your feature request related to a problem? Please describe.
Version 0.21.0 changes the name of generated mutations from createXYZ to createOneXYZ (similar for update / delete). This introduces a sizable effort to migrate to Prisma 4 and typgraphql-prisma 0.21.0. Also, I personally liked the old naming convention better 😬. It was clear and concise... the One suffix doesn't really add much value.

Describe the solution you'd like
Would you consider adding an option to opt-out of the One suffix? Or alternatively, check with the community and go back to the old approach if there is sufficient support?

Thanks! Otherwise, v 0.21.0 looks great... typegraphql-prisma is an amazing package, appreciate all the work that goes into it.

@MichalLytek
Copy link
Owner

typegraphql-prisma always tries to minimize the translations and traction between Prisma DMMF and generated resolvers.
Having to adjust, transform and simplify is currently out of scope because otherwise I couldn't even follow with the changes and upgrades of Prisma Client API and features.

However, I agree that this breaking change might be hard to upgrade for users that have an existing GraphQL API.
We definitely can have a generator option to use the "standard" naming, but I can't provide any ETA for that.

@MichalLytek MichalLytek added enhancement New feature or request priority:low This issue has a low priority and will be done after all the others community Something initiated by the community labels Jul 11, 2022
@SheaBelsky
Copy link

Because of the scope of this change, is there a reason this particular release was not marked as a breaking change (1.0.0)? Does typegraphql-prisma follow semver for versioning?

@MichalLytek
Copy link
Owner

@SheaBelsky Please read about semver in 0.x releases

https://semver.org/

Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.

npm treats 0.x releases as 0.major.minor:
https://github.com/npm/node-semver#caret-ranges-123-025-004

@SheaBelsky
Copy link

TIL - sorry for my initial misunderstanding!

@aldeed
Copy link
aldeed commented Jul 27, 2022

Rather than trying to define "standard", I would vote for something more generic like an explicit rename mapping in generator config (createOne: create).

Also, @MichalLytek, there are several generator examples in the docs that are now wrong due to this change. For example, showing createCategory as the key when it should now be createOneCategory for the TS to be valid.

@MichalLytek
Copy link
Owner

@aldeed You're right. The problem deeps down even further - the Prisma input names are still using the old name, so we have in schema e.g. createOneCreator(data: CreatorCreateInput!): Creator! 😕

Explicit mapping is tricky as we already have hardcoded mapping like findManyUser -> users via the useOriginalMapping = true generator option.

@MichalLytek MichalLytek added priority:high This issue is important and will be done first and removed priority:low This issue has a low priority and will be done after all the others labels Jul 27, 2022
@MichalLytek MichalLytek self-assigned this Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Something initiated by the community enhancement New feature or request priority:high This issue is important and will be done first
Projects
None yet
Development

No branches or pull requests

4 participants