[Python] refactor pydantic model methods into abstract python codegen (#16279)

* refactor methods from python client to abstract python codegen

* refactor regular expression methods

* more refactoring

* more refactoring
This commit is contained in:
William Cheng
2023-08-08 20:42:43 +08:00
committed by GitHub
parent f3b930c48c
commit 3d064c6115
5 changed files with 1201 additions and 1197 deletions

View File

@@ -138,7 +138,7 @@ async def get_user_by_name(
response_model_by_alias=True,
)
async def login_user(
username: str = Query(None, description="The user name for login", regex=r"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$"),
username: str = Query(None, description="The user name for login", regex=r"/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/"),
password: str = Query(None, description="The password for login in clear text"),
) -> str:
""""""

View File

@@ -25,7 +25,7 @@ class Category(BaseModel):
@validator("name")
def name_pattern(cls, value):
assert value is not None and re.match(r"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", value)
assert value is not None and re.match(r"/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/", value)
return value
Category.update_forward_refs()