codeant-ai-for-open-source[bot] commented on code in PR #37806:
URL: https://github.com/apache/superset/pull/37806#discussion_r3408417760
##########
superset/dashboards/api.py:
##########
@@ -754,7 +754,7 @@ def post(self) -> Response:
return self.response_400(message=error.messages)
try:
new_model = CreateDashboardCommand(item).run()
- return self.response(201, id=new_model.id, result=item)
+ return self.response(201, id=new_model.id, result=item,
uuid=new_model.uuid)
Review Comment:
**Suggestion:** The response now includes a new top-level `uuid` field, but
the documented 201 response schema for this endpoint still only declares `id`
and `result`. This creates an API contract mismatch for OpenAPI-based clients
and validators, so update the OpenAPI response properties to include `uuid`
(type `string`, format `uuid`) to keep runtime behavior and spec in sync. [api
mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Dashboard create uuid missing from OpenAPI response schema.
- ⚠️ Generated dashboard client types omit uuid field.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Start Superset with this PR's code deployed.
2. Log in and GET the OpenAPI spec at `api/v1/_openapi` as done in
`tests/integration_tests/base_api_tests.py:10-15`.
3. In the returned spec, inspect the
`paths["/api/v1/dashboard/"]["post"]["responses"]["201"]["content"]["application/json"]["schema"]["properties"]`
derived from the docstring at `superset/dashboards/api.py:744-749`, which
only documents
`id` and `result`.
4. Create a dashboard via `POST /api/v1/dashboard/` handled by
`DashboardRestApi.post` at
`superset/dashboards/api.py:718-758` and observe the JSON response includes
a top-level
`uuid` field from line 757, which is not present in the OpenAPI schema,
causing contract
divergence for spec-driven clients.
```
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=76bc03dbcf74436cad5a695203ed3d3f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=76bc03dbcf74436cad5a695203ed3d3f&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/dashboards/api.py
**Line:** 757:757
**Comment:**
*Api Mismatch: The response now includes a new top-level `uuid` field,
but the documented 201 response schema for this endpoint still only declares
`id` and `result`. This creates an API contract mismatch for OpenAPI-based
clients and validators, so update the OpenAPI response properties to include
`uuid` (type `string`, format `uuid`) to keep runtime behavior and spec in sync.
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%2F37806&comment_hash=64081e20cf9cc47524ee0b0f2b0e63a8a5bb11b6f6b924b0a55dcf8ef5416b9d&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37806&comment_hash=64081e20cf9cc47524ee0b0f2b0e63a8a5bb11b6f6b924b0a55dcf8ef5416b9d&reaction=dislike'>👎</a>
##########
superset/datasets/api.py:
##########
@@ -357,7 +357,13 @@ def post(self) -> Response:
try:
new_model = CreateDatasetCommand(item).run()
- return self.response(201, id=new_model.id, result=item,
data=new_model.data)
+ return self.response(
+ 201,
+ id=new_model.id,
+ result=item,
+ data=new_model.data,
+ uuid=new_model.uuid,
+ )
Review Comment:
**Suggestion:** The POST handler now returns a top-level `uuid`, but the 201
response schema in the same endpoint still documents only `id` and `result`, so
spec-driven consumers will not see the new field in their generated
types/contracts. Add `uuid` to the documented response schema to prevent
runtime/spec divergence. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Dataset create uuid absent from OpenAPI response schema.
- ⚠️ Generated dataset client models lack uuid property.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Start Superset with this PR's code deployed.
2. Log in and GET the OpenAPI spec at `api/v1/_openapi` as shown in
`tests/integration_tests/base_api_tests.py:10-15`.
3. In the spec, inspect
`paths["/api/v1/dataset/"]["post"]["responses"]["201"]["content"]["application/json"]["schema"]["properties"]`
generated from the docstring at `superset/datasets/api.py:347-351`, which
only declares
`id` and `result`.
4. Create a dataset via `POST /api/v1/dataset/` handled by
`DatasetRestApi.post` at
`superset/datasets/api.py:352-37` and observe the JSON response from lines
360-366
includes top-level `uuid` (and `data`), which are not documented in the 201
response
schema, leading to mismatch for OpenAPI-based tooling and generated client
contracts.
```
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d4efebc16ef3470c8b1f2e58a2dd4448&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=d4efebc16ef3470c8b1f2e58a2dd4448&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/datasets/api.py
**Line:** 360:366
**Comment:**
*Api Mismatch: The POST handler now returns a top-level `uuid`, but the
201 response schema in the same endpoint still documents only `id` and
`result`, so spec-driven consumers will not see the new field in their
generated types/contracts. Add `uuid` to the documented response schema to
prevent runtime/spec divergence.
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%2F37806&comment_hash=a17124cdb2602c7b105f6ca452fb094e48d4417f2571cc0f0492c309c7972b21&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37806&comment_hash=a17124cdb2602c7b105f6ca452fb094e48d4417f2571cc0f0492c309c7972b21&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]