-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Fix Rest API update user output #29409
Conversation
Can you describe the issue and update the title too |
Yeah sorry, I confess I had been lazy on this one :| |
@@ -2288,7 +2288,7 @@ paths: | |||
content: | |||
application/json: | |||
schema: | |||
$ref: '#/components/schemas/Role' | |||
$ref: '#/components/schemas/User' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ref: '#/components/schemas/User' | |
$ref: '#/components/schemas/UserCollectionItem' |
UserCollectionItem is more appropriate here. You also need to add test to protect accidental changing in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks for the suggestion. Regarding the tests, it seems there are already some tests here but regardless of the schema referenced in v1.yaml
, it always return the same schema of data (the correct one). Any idea why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea @ephraimbuddy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's strange to me that the response is not enforced in the spec. I had thought that the spec provides input and output validation but this proves otherwise
* Fix patch user API * Use UserCollectionItem (cherry picked from commit 20206e9)
* Fix patch user API * Use UserCollectionItem (cherry picked from commit 20206e9)
The Rest API update user returns the wrong schema. It currently return the role schema instead of the user's. I found out this bug while reading the documentation. You can see here the response of update user API is Role's model