Repository navigation
refactor(api): migrate console/service_api.dataset.segment to BaseModel - #36522
Merged
Merged
Conversation
cqjjjzr
requested review from
JohnJyong,
QuantumGhost,
crazywoola and
laipz8200
as code owners
May 22, 2026 08:51
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-30 13:36:25.381661160 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-30 13:36:11.181442539 +0000
@@ -2346,24 +2346,6 @@
--> tests/unit_tests/controllers/service_api/dataset/rag_pipeline/test_rag_pipeline_workflow.py:328:33
ERROR Missing argument `response_mode` in function `services.rag_pipeline.entity.pipeline_service_api_entities.PipelineRunApiEntity.__init__` [missing-argument]
--> tests/unit_tests/controllers/service_api/dataset/rag_pipeline/test_rag_pipeline_workflow.py:328:33
-ERROR Argument `list[dict[str, Any]] | 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:52:20
-ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:75:16
-ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:76:16
-ERROR Missing argument `content` in function `controllers.common.controller_schemas.ChildChunkCreatePayload.__init__` [missing-argument]
- --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:120:36
-ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:160:33
-ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
- --> tests/unit_tests/controllers/service_api/dataset/test_dataset_segment.py:165:33
-ERROR Argument `list[DocumentSegment] | 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:295:20
-ERROR Missing argument `tenant_id` in function `services.dataset_service.SegmentService.get_segments` [missing-argument]
- --> 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]
|
Contributor
Pyrefly Type Coverage
|
Contributor
|
just a note here: if this get merged, maybe use model validate directly makes sense. |
cqjjjzr
force-pushed
the
refac-basemodel-3
branch
from
May 25, 2026 02:36
bdbfb1b to
25371a6
Compare
Contributor
|
resolve the conflict |
cqjjjzr
force-pushed
the
refac-basemodel-3
branch
from
May 25, 2026 08:21
25371a6 to
003bdc9
Compare
4 of 5 tasks
cqjjjzr
force-pushed
the
refac-basemodel-3
branch
from
May 25, 2026 15:17
003bdc9 to
bc93ee6
Compare
asukaminato0721
enabled auto-merge
May 27, 2026 10:18
WH-2099
self-requested a review
May 30, 2026 11:58
WH-2099
previously approved these changes
May 30, 2026
WH-2099
force-pushed
the
refac-basemodel-3
branch
from
May 30, 2026 13:35
eb72deb to
c5d82f8
Compare
WH-2099
approved these changes
May 30, 2026
Ssazurov
pushed a commit
to Ssazurov/dify
that referenced
this pull request
Aug 8, 2026
…el (langgenius#36522) Co-authored-by: WH-2099 <wh2099@pm.me> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Fixes #<issue number>.Summary
See #28015 . Replace all inline Flask-RESTX request/response payload and query param models to Pydantic BaseModel.
Also added schema tool for query param parsing. See #36519 for issue aroused.
Affected:
controllers/console/datasets/datasets_segments.pycontrollers/service_api/dataset/segment.pyChecklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods