Files
dify/api/controllers/openapi/app_info.py
GareArc e006eb7a4b refactor(openapi): _AppReadResource base for per-app reads
Four per-app GETs (/apps/<id>, /info, /parameters, /describe) repeated
the same SSO-guard / app-load / membership-check pattern. Hoist into
_AppReadResource with method_decorators=[require_scope, validate_bearer]
plus _load(app_id) -> (App, AuthContext). Subclasses now 3-line bodies.
Eliminates the per-method # type: ignore[reportUntypedFunctionDecorator]
suppression by relocating the decorator chain to the class attribute.
Endpoints now build typed AppInfoResponse / AppDescribeResponse and
.model_dump() at the boundary.
2026-05-05 19:51:42 -07:00

14 lines
475 B
Python

"""GET /openapi/v1/apps/<app_id>/info — port of service_api/app/app.py:AppInfoApi."""
from __future__ import annotations
from controllers.openapi import openapi_ns
from controllers.openapi.apps import _AppReadResource, app_info_payload # pyright: ignore[reportPrivateUsage]
@openapi_ns.route("/apps/<string:app_id>/info")
class AppInfoApi(_AppReadResource):
def get(self, app_id: str):
app, _ = self._load(app_id)
return app_info_payload(app), 200