-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Swagger /admin/users/{username} returns 422 Error: Unprocessable Entity #17126
Comments
Additional note: I tested the same scenario using Gitea API. |
Maybe it intentional? Visibility parameters may be only "public", "limited", "private" others values return 422 |
What is the content of what you are trying to send via PATCH? |
I will try to send only required field, step by step put additional fields, error only returned if "visibility" field not have valid values. Also check POST /admin/users - it behave same way. |
Hi, On a test installation of gitea 1.15.3 with PostgreSQL 11 running on Debian 10 Buster I am trying to change a user with following path: { Up to version 1.14.7 all is working fine. I will test with versions between 1.14.7 and 1.15.3 and report back the results. |
Tests with all 1.15.x versions (including -rc1, -rc2 and -rc3) show same Error 422 "Unprocessable Entity". All tests were done in a consistent way with the same data by using an ansible playbook. Means, the issue started with 1.15.0-rc1. Last known good version is 1.14.7. With the current status and error message it is very hard to debug. You would have to try with brute force methods. I would suggest improving the API error message and show which field is not accepted. Hope that helps. |
- Add the related fieldNames into the response JSON, such that the developer can figure out what's going on. - Related: go-gitea#17126 (comment)
Hi! I gave this issue a go and I wasn't able to reproduce this - the 422 error only should happen on wrong requests format(e.g. sending json data but not the correct Content-Type header).
See #17750 |
- Add the related fieldNames into the response JSON, such that the developer can figure out what's going on. - Related: #17126 (comment)
This bit me as well with rootless docker image v. 1.15.6 and ansible setup.
|
Finally, after extensive trial and error, I found the issue: With versions 1.15.x and 1.16.x the user field "website" cannot be updated through the API. As soon as you remove the field "website" all is working as expected. I tried different content for "website", e.g. "", "string", "example.com", "www.example.com" or even "https://www.example.com", but none of those were accepted. In all cases I got the same error message: Example json causing error: Example json OK (only difference is "website" is omitted): @rscataran, please test again without providing the field "website" and confirm your results. Thanks |
This is great! Thank you for your tests. I have tested it with the current version 1.16.2 and it works as stated. omitting the "website" on the json results in 200 OK and when I tried putting a value on "website" error 422 resulted. I also tried this on the latest 1.15.10 version and the same results are produced. When "website" parameter in json is omitted (200OK). I'll close this issue since I don't intend to change the website of the user over API for the time being. But this feature maybe needed in the future, so this thread will be a useful reference. Cheers! |
- Add the related fieldNames into the response JSON, such that the developer can figure out what's going on. - Related: go-gitea#17126 (comment)
Gitea Version
1.15.3 built with GNU Make 4.1, go1.16.8 : bindata, sqlite, sqlite_unlock_notify
Git Version
No response
Operating System
Windows 10
How are you running Gitea?
a command-line
Database
SQLite
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
When using the web Api
/api/swagger
PATCH
/admin/users/{username}
Edit an existing userresults in 422
Error: Unprocessable Entity
I can confirm that the token is working because GET
/admin/users
List all users is working as expected.Also, user 034732 exists on the list generated by
/admin/users
I am using the sample model provided by swagger on PATCH
/admin/users/{username}
Edit an existing user.I just supplied the
username of user to edit
= 034732The text was updated successfully, but these errors were encountered: