ForcePilot/backend/package/yuxi/channels/contract/dtos/config_validate.py
Kris b88c0ae29e feat(channels): 批量新增多渠道网关限界上下文基础代码与契约
新增完整的 channels 限界上下文模块,包含契约层、领域核心层、应用服务、管道编排、插件体系、基础设施组合根等全层级代码,新增飞书与微信 iLink 渠道插件基础结构,补充各类 DTO、端口协议与领域服务实现。
2026-07-02 03:22:12 +08:00

66 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""配置校验 DTO。
定义渠道插件配置校验的不可变值对象,包括配置校验错误项、警告项与校验
结果。所有 DTO 均为 ``dataclass(frozen=True)``,仅依赖标准库,用于
``WizardAdapter.runWizardStep``(安装时)与 ``DoctorAdapter.runItem``
运行时的配置校验流程PRD §4.0.4 核心方法 2配置校验
"""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class ConfigError:
"""配置校验错误项。
描述单项配置校验错误,包括字段路径、错误消息与错误码,用于配置校验
结果的错误详情。
字段:
field_path: 字段路径(如 "credentials.app_id")。
message: 错误消息。
error_code: 错误码(如 "missing_field" / "invalid_format")。
"""
field_path: str
message: str
error_code: str
@dataclass(frozen=True)
class ConfigWarning:
"""配置校验警告项。
描述单项配置校验警告,包括字段路径与警告消息,用于配置校验结果的
警告详情。
字段:
field_path: 字段路径。
message: 警告消息。
"""
field_path: str
message: str
@dataclass(frozen=True)
class ConfigValidateResult:
"""配置校验结果。
描述配置校验的最终结果,包括是否有效、错误列表与警告列表,作为
``WizardAdapter.runWizardStep`` / ``DoctorAdapter.runItem``
配置校验流程的返回值PRD §4.0.4 核心方法 2配置校验
集合字段使用 tuple 以保证 frozen dataclass 的不可变语义。
字段:
valid: 是否校验通过。
errors: 错误列表(默认空 tuple
warnings: 警告列表(默认空 tuple
"""
valid: bool
errors: tuple[ConfigError, ...] = ()
warnings: tuple[ConfigWarning, ...] = ()