Skip to content

refactor(api): migrate console recommended-app response to BaseModel#35206

Merged
asukaminato0721 merged 3 commits intolanggenius:mainfrom
ai-hpc:refactor/migrate-console-recommended-app-response-28015
Apr 14, 2026
Merged

refactor(api): migrate console recommended-app response to BaseModel#35206
asukaminato0721 merged 3 commits intolanggenius:mainfrom
ai-hpc:refactor/migrate-console-recommended-app-response-28015

Conversation

@ai-hpc
Copy link
Copy Markdown
Contributor

@ai-hpc ai-hpc commented Apr 14, 2026

Part of #28015

Summary

Migrate console recommended-app list response from Flask-RESTX api.model(...)/@marshal_with to Pydantic BaseModel schemas registered via register_schema_models(). Preserve response shape and icon URL behavior with computed icon_url based on icon_type.

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 and make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. refactor labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@asukaminato0721 asukaminato0721 requested a review from Copilot April 14, 2026 18:21
@asukaminato0721 asukaminato0721 self-assigned this Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the console “recommended apps” list endpoint to return responses serialized via Pydantic BaseModel/ResponseModel schemas registered with register_schema_models(), replacing Flask-RESTX api.model(...)/@marshal_with while preserving the documented response shape and icon_url behavior.

Changes:

  • Replace Flask-RESTX field models/marshalling with Pydantic response schemas for /explore/apps.
  • Add computed icon_url on the response model based on icon_type/icon.
  • Add unit tests covering response model serialization and icon_url computation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
api/controllers/console/explore/recommended_app.py Migrates the recommended-app list response to ResponseModel Pydantic schemas and registers them for Swagger docs.
api/tests/unit_tests/controllers/console/explore/test_recommended_app.py Adds tests for the new response models and their computed icon_url behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

auto-merge was automatically disabled April 14, 2026 19:28

Head branch was pushed to by a user without write access

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-14 19:29:45.065830142 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-14 19:29:34.745611640 +0000
@@ -1,5 +1,5 @@
 ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
-   --> controllers/console/app/app.py:561:13
+   --> controllers/console/app/app.py:552:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
   --> controllers/console/auth/email_register.py:75:108
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 14, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 14, 2026
Merged via the queue into langgenius:main with commit f66a3c4 Apr 14, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants