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.

refactor: part of remove all reqparser (#29847)

Asuka Minato7e06225ce25e
diff --git a/api/controllers/console/billing/billing.py b/api/controllers/console/billing/billing.py
index 7f907dc4207..ac039f9c5de 100644
--- a/api/controllers/console/billing/billing.py
+++ b/api/controllers/console/billing/billing.py
@@ -1,8 +1,9 @@
import base64
+from typing import Literal
from flask import request
from flask_restx import Resource, fields
-from pydantic import BaseModel, Field, field_validator
+from pydantic import BaseModel, Field
from werkzeug.exceptions import BadRequest
from controllers.console import console_ns
@@ -15,22 +16,8 @@ DEFAULT_REF_TEMPLATE_SWAGGER_2_0 = "#/definitions/{model}"
class SubscriptionQuery(BaseModel):
- plan: str = Field(..., description="Subscription plan")
- interval: str = Field(..., description="Billing interval")
-
- @field_validator("plan")
- @classmethod
- def validate_plan(cls, value: str) -> str:
- if value not in [CloudPlan.PROFESSIONAL, CloudPlan.TEAM]:
- raise ValueError("Invalid plan")
- return value
-
- @field_validator("interval")
- @classmethod
- def validate_interval(cls, value: str) -> str:
- if value not in {"month", "year"}:
- raise ValueError("Invalid interval")
- return value
+ plan: Literal[CloudPlan.PROFESSIONAL, CloudPlan.TEAM] = Field(..., description="Subscription plan")
+ interval: Literal["month", "year"] = Field(..., description="Billing interval")
class PartnerTenantsPayload(BaseModel):