From 5a9045cd6334d2ea0b0171b6563e09c3e3bc4f7f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:41:51 +0000 Subject: [PATCH] Proof-of-concept: Resource to MethodView conversion research Co-authored-by: asukaminato0721 <30024051+asukaminato0721@users.noreply.github.com> --- api/controllers/service_api/__init__.py | 6 +++++- api/controllers/service_api/index.py | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/controllers/service_api/__init__.py b/api/controllers/service_api/__init__.py index 9032733e2c..05fb3aa629 100644 --- a/api/controllers/service_api/__init__.py +++ b/api/controllers/service_api/__init__.py @@ -36,6 +36,9 @@ from .dataset import ( ) from .workspace import models +# Register MethodView classes with the blueprint +bp.add_url_rule("/", view_func=index.IndexApi.as_view("index_api"), methods=["GET"]) + __all__ = [ "annotation", "app", @@ -56,4 +59,5 @@ __all__ = [ "workflow", ] -api.add_namespace(service_api_ns) +# Temporarily disable namespace registration to test MethodView +# api.add_namespace(service_api_ns) diff --git a/api/controllers/service_api/index.py b/api/controllers/service_api/index.py index a9d2d6fadc..2252931b5b 100644 --- a/api/controllers/service_api/index.py +++ b/api/controllers/service_api/index.py @@ -1,11 +1,9 @@ -from flask_restx import Resource +from flask.views import MethodView from configs import dify_config -from controllers.service_api import service_api_ns -@service_api_ns.route("/") -class IndexApi(Resource): +class IndexApi(MethodView): def get(self): return { "welcome": "Dify OpenAPI",