-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
Star 8.9k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when I pass my object to validate equal null #795
Error when I pass my object to validate equal null #795
Comments
JeremySkinner
commented
Jun 20, 2018
Hi there, please could you post your question in English? Looking at the screenshot, you must provide a non-null root instance. This is by design. |
raffaelmiranda
commented
Jun 20, 2018
Hi Jeremy thanks for answering, I'm using google translator |
raffaelmiranda
commented
Jun 20, 2018
•
edited
edited
Is there a possibility, to include in the library to see this validation, when it comes to object null? |
JeremySkinner
commented
Jun 20, 2018
No, that's not possible I'm afraid - FluentValidation is designed to validate properties on a non-null object instance. You can't pass a null instance to |
raffaelmiranda
commented
Jun 20, 2018
Is this also true for an instantiated object that contains a null list? I can do something about it: |
JeremySkinner
commented
Jun 20, 2018
That's fine, the list can be null, but you should put a
|
JeremySkinner
commented
Jun 20, 2018
Or you could combine them into a single rule and use the
|
raffaelmiranda
commented
Jun 20, 2018
I understood the explanation and thank you for your time. |
JeremySkinner
commented
Jun 20, 2018
You're welcome - let me know if you have any other questions. |
Hello everyone
I'm sorry I do not speak English and also if this channel is not considered appropriate for clarification of doubt. I am building a WebApi in .Net core 2.0 using version 7.5.2.
A validation that I must do is when my client that will consume my WebApi, should check if the object that arrived is null and for this I did the following validation
My validations
My startup class
Meu controller (My controller)
And to trigger validation
My FaturaDto object came null and it is this test I would like to include but when the validation is triggered an error occurs "ArgumentNullException: Value can not be null. Parameter name: Can not pass null model to Validate."
The text was updated successfully, but these errors were encountered: