Skip to content

refactor(api): migrate workspace current response from marshal_with to BaseModel#35207

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
ai-hpc:refactor/migrate-console-workspace-current-response-28015
Apr 14, 2026
Merged

refactor(api): migrate workspace current response from marshal_with to BaseModel#35207
asukaminato0721 merged 1 commit intolanggenius:mainfrom
ai-hpc:refactor/migrate-console-workspace-current-response-28015

Conversation

@ai-hpc
Copy link
Copy Markdown
Contributor

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

Part of #28015

Summary

Migrate /workspaces/current (TenantApi.post) response serialization from @marshal_with to a Pydantic BaseModel (TenantInfoResponse) while preserving existing response payload shape and status code behavior. Normalize enum-like fields and datetime timestamps.

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

This PR migrates the /workspaces/current (and deprecated /info) response serialization in TenantApi.post from Flask-RESTX @marshal_with to a Pydantic response model (TenantInfoResponse), aiming to preserve the existing payload shape while normalizing enum-like values and timestamps.

Changes:

  • Introduces TenantInfoResponse (Pydantic ResponseModel) with validators to normalize enum-like fields and created_at timestamps.
  • Updates TenantApi.post to serialize via TenantInfoResponse.model_validate(...).model_dump(mode="json") and updates the documented 200-response schema.
  • Adds a unit test covering enum/datetime normalization behavior of TenantInfoResponse.

Reviewed changes

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

File Description
api/controllers/console/workspace/workspace.py Adds TenantInfoResponse and switches /workspaces/current response serialization to Pydantic-based dumping + updates response documentation.
api/tests/unit_tests/controllers/console/workspace/test_workspace.py Adds a unit test verifying TenantInfoResponse normalizes enum-like inputs and datetimes to the expected JSON-friendly forms.

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

@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 ef396ac Apr 14, 2026
32 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: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