Files
dify/api/controllers/openapi/index.py
L1nSn0w ec67426ff6 refactor(openapi): migrate response handlers to @returns
Complete the request/response contract unification (GareArc review followup):
the remaining handlers that returned a model via manual `.model_dump(mode="json")`
now return the bare model behind `@returns`, so every openapi handler references
its response model once and doc == runtime.

Migrated: version, health, account info/session-revoke (x2), file upload, task
stop, human-input form submit, and workspaces list/detail/switch/invite/remove/
role. Handlers returning a bare dict (account info, version, health) now go through
`@returns` → `(body, status)`; HTTP behavior is unchanged. Health/task-stop/form-submit
now construct their advertised model instead of a hand-built dict.
2026-06-10 10:04:43 +08:00

13 lines
361 B
Python

from flask_restx import Resource
from controllers.openapi import openapi_ns
from controllers.openapi._contract import returns
from controllers.openapi._models import HealthResponse
@openapi_ns.route("/_health")
class HealthApi(Resource):
@returns(200, HealthResponse, description="Health check")
def get(self):
return HealthResponse(ok=True)