Skip to content

refactor(api): migrate console tag responses from marshal_with to BaseModel#35208

Open
ai-hpc wants to merge 2 commits intolanggenius:mainfrom
ai-hpc:refactor/migrate-console-tags-response-28015
Open

refactor(api): migrate console tag responses from marshal_with to BaseModel#35208
ai-hpc wants to merge 2 commits intolanggenius:mainfrom
ai-hpc:refactor/migrate-console-tags-response-28015

Conversation

@ai-hpc
Copy link
Copy Markdown
Contributor

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

Part of #28015

Summary

Replace @marshal_with in console tag list response path with Pydantic BaseModel serialization. Add TagResponse schema registration and normalize enum-backed type values while keeping endpoint response shape unchanged.

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:M This PR changes 30-99 lines, ignoring generated files. refactor labels 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 tag endpoints to stop using Flask-RESTX @marshal_with for the tag list response and instead serialize responses via Pydantic BaseModel (via ResponseModel), while registering the response schema for API documentation.

Changes:

  • Introduces TagResponse(ResponseModel) and registers it with console_ns for schema docs.
  • Updates GET /tags to return a list of TagResponse-serialized dicts instead of relying on @marshal_with.
  • Adds a unit test to verify TagResponse normalizes enum-backed type values during JSON serialization.

Reviewed changes

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

File Description
api/controllers/console/tag/tags.py Replaces @marshal_with response marshalling with Pydantic serialization; adds TagResponse schema + normalization validator.
api/tests/unit_tests/controllers/console/tag/test_tags.py Adds a unit test covering TagResponse enum normalization behavior.

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

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

Head branch was pushed to by a user without write access

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 14, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 14, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 14, 2026
@ai-hpc
Copy link
Copy Markdown
Contributor Author

ai-hpc commented Apr 14, 2026

@asukaminato0721 please merge

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:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants