Skip to content

refactor(api): migrate console/service_api.dataset.document to BaseModel#36506

Open
cqjjjzr wants to merge 1 commit into
langgenius:mainfrom
cqjjjzr:refac-basemodel
Open

refactor(api): migrate console/service_api.dataset.document to BaseModel#36506
cqjjjzr wants to merge 1 commit into
langgenius:mainfrom
cqjjjzr:refac-basemodel

Conversation

@cqjjjzr
Copy link
Copy Markdown
Contributor

@cqjjjzr cqjjjzr commented May 22, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

See #28015 . Replace all inline Flask-RESTX request/response payload and query param models to Pydantic BaseModel.

Affected:

  • controllers.console.datasets.datasets_document
  • controllers.service_api.dataset.document

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. refactor labels May 22, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-25 02:09:17.874165097 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-25 02:09:08.375137690 +0000
@@ -2116,10 +2116,6 @@
    --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:304:54
 ERROR Argument `list[str] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
    --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:597:20
-ERROR Object of class `NoneType` has no attribute `name` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/dataset/test_document.py:238:16
-ERROR Object of class `NoneType` has no attribute `indexing_status` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/dataset/test_document.py:239:16
 ERROR Missing argument `app_model` in function `protected_view` [missing-argument]
    --> tests/unit_tests/controllers/service_api/test_wraps.py:160:36
 ERROR `object` is not assignable to attribute `request` with type `Request` [bad-assignment]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 45.35% 45.40% +0.05%
Strict coverage 44.87% 44.92% +0.05%
Typed symbols 23,382 23,418 +36
Untyped symbols 28,477 28,466 -11
Modules 2610 2610 0

@asukaminato0721 asukaminato0721 enabled auto-merge May 22, 2026 04:12
auto-merge was automatically disabled May 22, 2026 04:17

Head branch was pushed to by a user without write access

@cqjjjzr cqjjjzr force-pushed the refac-basemodel branch from 113058b to 28e4977 Compare May 22, 2026 04:17
@asukaminato0721 asukaminato0721 enabled auto-merge May 22, 2026 04:29
auto-merge was automatically disabled May 25, 2026 02:07

Head branch was pushed to by a user without write access

@cqjjjzr cqjjjzr force-pushed the refac-basemodel branch from 28e4977 to 1375a96 Compare May 25, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant