diff --git a/apiserver/paasng/paasng/platform/bkapp_model/serializers/serializers.py b/apiserver/paasng/paasng/platform/bkapp_model/serializers/serializers.py index a75f48880f..d673e18204 100644 --- a/apiserver/paasng/paasng/platform/bkapp_model/serializers/serializers.py +++ b/apiserver/paasng/paasng/platform/bkapp_model/serializers/serializers.py @@ -25,7 +25,6 @@ from paas_wl.bk_app.cnative.specs.constants import ScalingPolicy from paas_wl.bk_app.processes.serializers import MetricSpecSLZ from paas_wl.workloads.autoscaling.constants import DEFAULT_METRICS -from paasng.platform.applications.models import Application from paasng.platform.bkapp_model.constants import PORT_PLACEHOLDER, ExposedTypeName, NetworkProtocol from paasng.platform.modules.constants import DeployHookType from paasng.utils.dictx import get_items @@ -296,19 +295,6 @@ def to_internal_value(self, data): data = {"bk_app_code": data} return super().to_internal_value(data) - def validate(self, attrs): - """校验应用和模块存在,否则抛出异常""" - try: - application = Application.objects.get(code=attrs["bk_app_code"]) - except Application.DoesNotExist: - raise serializers.ValidationError(_("应用{}不存在").format(attrs["bk_app_code"])) - - # Check if module exists when the "module_name" is set - if module_name := attrs["module_name"]: # noqa: SIM102 - if not application.modules.filter(name=module_name).exists(): - raise serializers.ValidationError(_("模块{}不存在").format(module_name)) - return attrs - BkSaaSList: TypeAlias = List[Dict[str, Optional[str]]]