33 lines
722 B
Python
33 lines
722 B
Python
from enum import Enum
|
||
from typing import List
|
||
|
||
import pydantic
|
||
from pydantic import BaseModel
|
||
|
||
ENameRegex = pydantic.constr(regex="^[a-z_]{1,}$")
|
||
CNameRegex = pydantic.constr(regex="^[\u4e00-\u9fa5a-zA-Z0-9()]+$")
|
||
|
||
|
||
class Parameter(BaseModel):
|
||
ename: ENameRegex = "example_param"
|
||
cname: str = "示例参数"
|
||
description: str = "参数介绍文字"
|
||
|
||
|
||
class NatureEnum(Enum):
|
||
quantity = "定量"
|
||
quality = "定性"
|
||
|
||
|
||
class IndicatorDescription(BaseModel):
|
||
ename: ENameRegex = "example_indicator"
|
||
cname: str = "示例指标"
|
||
description: str = "指标介绍文字"
|
||
nature: NatureEnum
|
||
category: str
|
||
parameters: List[Parameter]
|
||
|
||
class Config:
|
||
use_enum_values = True
|
||
|