From c8002460acc33472a92e505d275e71798ba49ac8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:45:40 +0000 Subject: [PATCH] Complete Resource to MethodView migration feasibility study 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, 5 insertions(+), 7 deletions(-) diff --git a/api/controllers/service_api/__init__.py b/api/controllers/service_api/__init__.py index 05fb3aa629..9032733e2c 100644 --- a/api/controllers/service_api/__init__.py +++ b/api/controllers/service_api/__init__.py @@ -36,9 +36,6 @@ 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", @@ -59,5 +56,4 @@ __all__ = [ "workflow", ] -# Temporarily disable namespace registration to test MethodView -# api.add_namespace(service_api_ns) +api.add_namespace(service_api_ns) diff --git a/api/controllers/service_api/index.py b/api/controllers/service_api/index.py index 2252931b5b..a9d2d6fadc 100644 --- a/api/controllers/service_api/index.py +++ b/api/controllers/service_api/index.py @@ -1,9 +1,11 @@ -from flask.views import MethodView +from flask_restx import Resource from configs import dify_config +from controllers.service_api import service_api_ns -class IndexApi(MethodView): +@service_api_ns.route("/") +class IndexApi(Resource): def get(self): return { "welcome": "Dify OpenAPI",