Skip to content

refactor: remove marshal_with and inline api.model from app_import#34934

Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom
ai-hpc:refactor/migrate-app-import-to-pydantic
Apr 13, 2026
Merged

refactor: remove marshal_with and inline api.model from app_import#34934
asukaminato0721 merged 2 commits intolanggenius:mainfrom
ai-hpc:refactor/migrate-app-import-to-pydantic

Conversation

@ai-hpc
Copy link
Copy Markdown
Contributor

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

Part of #28015

Summary

Remove @marshal_with decorators and inline console_ns.model() definitions from app_import.py. The endpoints already serialize responses via Pydantic's .model_dump(mode="json"), making @marshal_with redundant. Use register_schema_models() instead of manual schema_model() for Swagger registration. Remove unused fields, marshal_with, and app_fields imports.

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

@ai-hpc ai-hpc requested a review from QuantumGhost as a code owner April 10, 2026 16:33
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 10, 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 app import controller to rely on Pydantic JSON serialization and centralized schema registration, removing legacy Flask-RESTX marshalling and inline Swagger model definitions.

Changes:

  • Removed @marshal_with usage and associated Flask-RESTX fields/app_fields model wiring from app_import.py.
  • Switched Swagger schema registration for the request payload to register_schema_models().
  • Cleaned up unused imports related to marshalling and field-based models.

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

Comment thread api/controllers/console/app/app_import.py
Comment thread api/controllers/console/app/app_import.py
Comment thread api/controllers/console/app/app_import.py
@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 13, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 13, 2026
Merged via the queue into langgenius:main with commit 6faf266 Apr 13, 2026
28 checks passed
HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
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