I want to use a GET endpoint /Users
with body parameters being either a person
or country
. I do not want to change the request call signature, but the parameters I am sending will be changed. Is this possible ?
class PersonInfo(AppUserInfo):
id: int
person: str
class CountryInfo(AppUserInfo):
id: int
country: str
@app.get("/Users")
def get_alias_api(personinfo: PersonInfo):
return {"data": personinfo}
@app.get("/Users")
def get_alias_api(countryinfo: CountryInfo):
return {"data": countryinfo}