refactor(api): migrate console workflow-trigger responses to BaseModel#35200
Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom Apr 14, 2026
Conversation
Contributor
Pyrefly DiffNo changes detected. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the ongoing migration away from Flask-RESTX @marshal_with/api.model(...) patterns by introducing registered Pydantic BaseModel/ResponseModel schemas for the console workflow trigger endpoints, while aiming to keep the response JSON shape unchanged.
Changes:
- Added Pydantic
ResponseModelresponse schemas for workflow trigger, trigger list, and webhook trigger responses. - Replaced
@marshal_with(...)usage with@console_ns.response(...)+ explicitmodel_validate(...).model_dump(mode="json")serialization in the affected endpoints. - Added unit tests covering Pydantic parsing and datetime JSON serialization behavior for the new response models.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
api/controllers/console/app/workflow_trigger.py |
Replaces RESTX marshaling with Pydantic response schemas + explicit JSON dumping for workflow trigger endpoints. |
api/tests/unit_tests/controllers/console/app/test_workflow_trigger_api.py |
Adds unit tests for the new Pydantic parser/response models and datetime JSON serialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-14 18:30:29.001907737 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-14 18:30:18.467906057 +0000
@@ -693,7 +693,7 @@
ERROR `dict[str, str | None]` is not assignable to attribute `env` with type `dict[str, str]` [bad-assignment]
--> tests/test_containers_integration_tests/conftest.py:204:39
ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
- --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:632:51
+ --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:633:51
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/controllers/console/app/test_chat_conversation_status_count_api.py:33:48
ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
|
asukaminato0721
approved these changes
Apr 14, 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.
Part of #28015
Summary
Replace
get_or_create_model(...)+@marshal_within console workflow trigger endpoints with registered PydanticBaseModelresponse schemas. Migrate webhook trigger, trigger list, and trigger enable responses while keeping response shape unchanged.Checklist
make lintandmake type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods