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

fix(raw queries): correct None handling for all fields #1000

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

AstreaTSS
Copy link
Contributor

@AstreaTSS AstreaTSS commented Aug 8, 2024

Change Summary

See #998 for the most part.

This PR goes in and makes the check mentioned in the above issue happen earlier.

Checklist

  • Unit tests for the changes exist
  • Tests pass without significant drop in coverage
  • Documentation reflects changes where applicable
  • Test snapshots have been updated if applicable

Note

Adding tests for JSON was not done due to technical difficulties I had when testing. Apparently, optional JSON fields can't accept a None value when being created, according to Prisma, despite the fact that I see it as optional in the schema used. I'll leave what errors I got below, though it may be just a me thing.

record = await client.types.create({'json_obj': None})
prisma.errors.MissingRequiredValueError: Unable to match input value to any allowed input type for the field. Parse errors: [Unable to match input value to any allowed input type for the field. Parse errors: [`data.json_obj`: A value is required but not set, `data.json_obj`: A value is required but not set], Unable to match input value to any allowed input type for the field. Parse errors: [`data.json_obj`: A value is required but not set, `data.json_obj`: A value is required but not set]]

Agreement

By submitting this pull request, I confirm that you can use, modify, copy and redistribute this contribution, under the terms of your choice.

@RobertCraigie RobertCraigie changed the title fix: use none instead of trying to deserialize for raw queries fix(raw queries): correct None handling for all fields Aug 9, 2024
@RobertCraigie
Copy link
Owner

Adding tests for JSON was not done due to technical difficulties I had when testing

ah I think this is because of #714

Copy link
Owner

@RobertCraigie RobertCraigie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for the PR! Sorry for the regression in the last release.

I pushed a commit adding tests for the synchronous client

@RobertCraigie RobertCraigie enabled auto-merge (squash) August 9, 2024 09:32
@RobertCraigie RobertCraigie merged commit 56dfa7c into RobertCraigie:main Aug 9, 2024
31 checks passed
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

Successfully merging this pull request may close these issues.

2 participants