-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Poor error response when using ModelState Validation with [ApiController] #1224
Comments
Hi @Alex-Doms, thanks for asking. I've created #1225 in an attempt to reproduce the problem, unfortunately without success. Can you share your controller code? Even better would be if you could extend the code from that PR to reproduce the response you're getting. |
Thanks, that's helpful. The reason you're hitting this is because your controller contains I'm not opposed to releasing that fix (assuming tests are added first). However, the big downside of using By using Do you have a specific reason to use |
Hum, well i'm using it because i'm migrating old API REST to JSONAPI, and we used SwaggerUI. |
I missed something else : the attribute [required ]does not seem to be checked as well. |
I see. Unfortunately, Swagger doesn't work very well with JADNC, regardless of
That's intentional. PATCH partially updates a resource, so any fields omitted in the request body are left unchanged. You should get an error in POST for that one, though. |
Ok, well noted! Thanks again! |
Hi, i have a last question, i tried a post request, with an
If i overrive the ID with this in my class : |
Why would you specify Of course, then you'll need to assign a value server-side in case |
SUMMARY
Hello, i try to add some data annotations on my resources. On my first tests, the ValidateModelState seems fired well when an attribute is not correct, but in the response, i don't have any details.
STEPS TO REPRODUCE
Resource :
Request :
Response :
I should have the detail where my "message" attribute is listed with my custom error.
Where did I miss something?
VERSIONS USED
The text was updated successfully, but these errors were encountered: