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

Automagic required and maxlength validation #152

Closed
rrjanbiah opened this issue Dec 10, 2016 · 4 comments
Closed

Automagic required and maxlength validation #152

rrjanbiah opened this issue Dec 10, 2016 · 4 comments

Comments

@rrjanbiah
Copy link

rrjanbiah commented Dec 10, 2016

Automatic validation constraints:

  • required validation using not null
  • maxlength validation using column length

(These have to be fetched from table schema and have to be cached)

@rrjanbiah
Copy link
Author

rrjanbiah commented Dec 10, 2016

How would you expect the API to behave?

Probably similar to what current validation callback does?

@mevdschee mevdschee self-assigned this Dec 11, 2016
@mevdschee
Copy link
Owner

What if you have not null with a default value? What do behavior do you expect? A validation error?

Shouldn't maxlength validation be done client side? What is the point of server side validation for that field? Databases either ignore (truncate) or fail the query, which is configurable. Not sure what would be expected.

@rrjanbiah
Copy link
Author

What if you have not null with a default value? What do behavior do you expect? A validation error?

DEFAULT value will be inserted in the absence of that field. But, if the filed is present, but empty, should throw error.

Shouldn't maxlength validation be done client side? What is the point of server side validation for that field? Databases either ignore (truncate) or fail the query, which is configurable. Not sure what would be expected.

I think, instead of silent fail, validation is essential. Should throw error.

@mevdschee
Copy link
Owner

mevdschee commented Dec 16, 2016

But, if the filed is present, but empty, should throw error.

How can you determine whether or not the user wants to save an empty string?

I think, instead of silent fail, validation is essential. Should throw error.

I agree, this should never reach the server as it should be validated on the client. I'm happy to agree to disagree here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants