forked from loafle/openapi-generator-original
[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:
parent
f3b930c48c
commit
3d064c6115
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -321,12 +321,6 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen {
|
|||||||
System.out.println("################################################################################");
|
System.out.println("################################################################################");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toRegularExpression(String pattern) {
|
|
||||||
String regex = super.toRegularExpression(pattern);
|
|
||||||
return StringUtils.substring(regex, 1, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generatorLanguageVersion() { return "3.7"; };
|
public String generatorLanguageVersion() { return "3.7"; };
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ async def get_user_by_name(
|
|||||||
response_model_by_alias=True,
|
response_model_by_alias=True,
|
||||||
)
|
)
|
||||||
async def login_user(
|
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"),
|
password: str = Query(None, description="The password for login in clear text"),
|
||||||
) -> str:
|
) -> str:
|
||||||
""""""
|
""""""
|
||||||
|
@ -25,7 +25,7 @@ class Category(BaseModel):
|
|||||||
|
|
||||||
@validator("name")
|
@validator("name")
|
||||||
def name_pattern(cls, value):
|
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
|
return value
|
||||||
|
|
||||||
Category.update_forward_refs()
|
Category.update_forward_refs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user