codeant-ai-for-open-source[bot] commented on code in PR #39469:
URL: https://github.com/apache/superset/pull/39469#discussion_r3612343546
##########
superset/views/users/api.py:
##########
@@ -161,6 +309,142 @@ def update_me(self) -> Response:
except ValidationError as error:
return self.response_400(message=error.messages)
+ @expose("/password", methods=["PUT"])
+ @protect()
+ @permission_name("write")
+ @safe
+ @statsd_metrics
+ @requires_json
+ @_rate_limit_me_password_change
+ def update_my_password(self) -> Response:
+ """Update the current user's password (AUTH_DB only)
+ ---
+ put:
+ summary: Update the current user's password
+ description: >-
+ Changes the authenticated user's password when ``AUTH_TYPE`` is
``AUTH_DB``.
+ Requires the current password and a new password that satisfies
+ ``AUTH_DB_CONFIG`` policy.
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CurrentUserPasswordPutSchema'
+ responses:
+ 200:
+ description: Password updated successfully
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ result:
+ $ref: '#/components/schemas/UserResponseSchema'
+ 400:
+ $ref: '#/components/responses/400'
+ 401:
+ $ref: '#/components/responses/401'
+ 429:
+ $ref: '#/components/responses/400'
Review Comment:
**Suggestion:** The OpenAPI response mapping declares a 429 status but
references the 400 schema, which is an incorrect contract for clients and
generated SDKs. Point 429 to a proper 429 response component so tooling and UI
error handling remain accurate. [docstring mismatch]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Generated SDKs mislabel schema for 429 rate-limit responses.
- โ ๏ธ API docs show incorrect reference for password rate limits.
```
</details>
<details>
<summary><b>Steps of Reproduction โ
</b></summary>
```mdx
1. Start the Superset web application and retrieve the OpenAPI specification
that includes
`CurrentUserRestApi` from `superset/views/users/api.py:171โ448` (typically
served via the
Swagger/OpenAPI UI endpoint configured in this project).
2. Locate the path definition for `PUT /api/v1/me/password`, whose docstring
responses
block appears at lines 335โ351 in `superset/views/users/api.py`.
3. Inspect the responses section and observe that the `429` response entry
(lines 348โ349)
is declared but references `#/components/responses/400` instead of a
dedicated
`#/components/responses/429` rate-limit response component.
4. Use code-generation tooling or client SDKs based on this OpenAPI spec and
note that
rate-limited password-change calls (triggered by
`_rate_limit_me_password_change` in the
same file) will be modeled as returning the 400-error schema, causing an
incorrect mapping
between HTTP 429 status codes and their documented response schema.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=04c12ef8fea94cce8f5bc90fcc9cce0e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=04c12ef8fea94cce8f5bc90fcc9cce0e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/users/api.py
**Line:** 348:349
**Comment:**
*Docstring Mismatch: The OpenAPI response mapping declares a 429 status
but references the 400 schema, which is an incorrect contract for clients and
generated SDKs. Point 429 to a proper 429 response component so tooling and UI
error handling remain accurate.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39469&comment_hash=06a8e97fd0ec02476cac4d606b74701f679f729405b04e10442658b056610db5&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39469&comment_hash=06a8e97fd0ec02476cac4d606b74701f679f729405b04e10442658b056610db5&reaction=dislike'>๐</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]