refactor(api): migrate workspace current response from marshal_with to BaseModel#35207
Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom Apr 14, 2026
Conversation
Contributor
Pyrefly DiffNo changes detected. |
Contributor
There was a problem hiding this comment.
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(PydanticResponseModel) with validators to normalize enum-like fields andcreated_attimestamps. - Updates
TenantApi.postto serialize viaTenantInfoResponse.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
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
Migrate
/workspaces/current(TenantApi.post) response serialization from@marshal_withto a PydanticBaseModel(TenantInfoResponse) while preserving existing response payload shape and status code behavior. Normalize enum-like fields and datetime timestamps.Checklist
make lintandmake type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods