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

Setting for forcing non-nullabillity #586

Open
joleeee opened this issue Aug 19, 2024 · 2 comments
Open

Setting for forcing non-nullabillity #586

joleeee opened this issue Aug 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@joleeee
Copy link

joleeee commented Aug 19, 2024

Describe the bug
There should be a setting to force non-nullability of all parameters, and make nullability possibly opt in with the ? suffix. I don't really see the use case of nullability, but it has bit me in the back a few times so far because i forget to att the ! suffix.

See also #583 #118

#118 (comment)

Hi, thanks!
Unfortunately, Postgres doesn't provide nullability information on parameter types, so we have to assume all parameters to be nullable by default.

This is not entirely true. We can also just assume they are not nullable. It would be less wrong imo. If you are not sure if something is nullable, better not assume it is.

@joleeee joleeee added the bug Something isn't working label Aug 19, 2024
@joleeee
Copy link
Author

joleeee commented Aug 19, 2024

Wait, I'm even more confused now. How come i cannot pass null into a field which has the ! suffix? Does ! both mean that it has to be specified, and that it cannot be NULL? What if I want to force a field to be specified, but allow it to be null?

@pnappa
Copy link

pnappa commented Aug 28, 2024

What if I want to force a field to be specified, but allow it to be null?

Yeah, annoyingly things are marked as optional if they're allowed to be null. I've opened a PR to allow toggling the default behaviour of optional parameters here #582 .

I do think there should be an option to make parameters not nullable by default too though!

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

No branches or pull requests

2 participants