Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(openapi): mark import.skill as destructive (#45314)

Xiyuan Chen61d2c7402feb
diff --git a/api/controllers/openapi/skills.py b/api/controllers/openapi/skills.py
index bf5b5ac00b1..b66aa2a07a2 100644
--- a/api/controllers/openapi/skills.py
+++ b/api/controllers/openapi/skills.py
@@ -21,6 +21,7 @@ from controllers.common.rbac import RBACCheck, RBACPermission, Workspace
from controllers.openapi import openapi_ns
from controllers.openapi._contract import (
CapRequestBody,
+ Effect,
Example,
Kind,
endpoint,
@@ -384,6 +385,7 @@ class SkillImportApi(Resource):
context="workspace",
op="import.skill",
kind=Kind.OBJECT,
+ effect=Effect.DESTRUCTIVE,
summary="Create a skill from a folder, or overwrite a skill's draft with one",
examples=(
Example(title="Create a skill", input={"files": {"SKILL.md": "./my-skill/SKILL.md"}}),
diff --git a/api/tests/unit_tests/controllers/openapi/test__catalog.py b/api/tests/unit_tests/controllers/openapi/test__catalog.py
index 097dd0ef424..0bce874f2ef 100644
--- a/api/tests/unit_tests/controllers/openapi/test__catalog.py
+++ b/api/tests/unit_tests/controllers/openapi/test__catalog.py
@@ -106,6 +106,7 @@ def test_every_guarded_route_declares_catalog_meta_once(app: Flask, ops: dict[st
("restore.console_app.version", Effect.DESTRUCTIVE),
("import.console_app.dsl", Effect.DESTRUCTIVE),
("confirm.console_app.dsl_import", Effect.DESTRUCTIVE),
+ ("import.skill", Effect.DESTRUCTIVE),
("stop.run", Effect.DESTRUCTIVE),
("stop.task", Effect.DESTRUCTIVE),
("check.console_app.dsl", Effect.READ),