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

Nullable fields generating broken field implementations #23

Closed
craiglabenz opened this issue Sep 19, 2022 · 3 comments · Fixed by #24
Closed

Nullable fields generating broken field implementations #23

craiglabenz opened this issue Sep 19, 2022 · 3 comments · Fixed by #24
Labels
bug Something isn't working

Comments

@craiglabenz
Copy link

While running the User / Post example in the README, I've encountered a problem with the initial generated code.

It seems that nullable fields (e.g., name String?) generate the following Dart code:

final _i2.PrismaNullable<_i2.PrismaUnion<StringNullableWithAggregatesFilter, String, _i2.PrismaNull>> name;

Which breaks, because the class definition for PrismaUnion accepts 2 type parameters

class PrismaUnion<T0, T1> {}

Yet we've provided three

PrismaUnion<StringNullableWithAggregatesFilter, String, _i2.PrismaNull>
@medz medz added the bug Something isn't working label Sep 20, 2022
@medz
Copy link
Owner

medz commented Sep 20, 2022

I checkedout a new branch to reproduce and will fix this.

@medz
Copy link
Owner

medz commented Sep 20, 2022

For this bug fix, I don't think the generated input object type should be PrismaUnion wrapped, just StringNullableWithAggregatesFilter.

However this is a breaking change and a separate test has been created for this issue.

It will be fixed in the 2.2.0 release after waiting for the CI to be added.

@medz medz closed this as completed in #24 Sep 20, 2022
medz added a commit that referenced this issue Sep 20, 2022
…n-field-implementations

Fixed #23 & input object types without `PrismaUnion` wrapper.
@medz
Copy link
Owner

medz commented Sep 20, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants