@ -287,6 +287,29 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
|
|||||||
" = " +
|
" = " +
|
||||||
ref +
|
ref +
|
||||||
".from_dict(response.json())\n")
|
".from_dict(response.json())\n")
|
||||||
|
elif 'type' in json:
|
||||||
|
if json['type'] == 'array':
|
||||||
|
items = json['items']
|
||||||
|
if '$ref' in items:
|
||||||
|
ref = items['$ref'].replace(
|
||||||
|
'#/components/schemas/', '')
|
||||||
|
f.write(
|
||||||
|
"\t\tresponse_" +
|
||||||
|
response_code +
|
||||||
|
" = [\n")
|
||||||
|
f.write(
|
||||||
|
"\t\t\t" +
|
||||||
|
ref +
|
||||||
|
".from_dict(item)\n")
|
||||||
|
f.write(
|
||||||
|
"\t\t\tfor item in response.json()\n")
|
||||||
|
f.write("\t\t]\n")
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown array type")
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
else:
|
||||||
|
raise Exception("Unknown type")
|
||||||
elif '$ref' in response:
|
elif '$ref' in response:
|
||||||
schema_name = response['$ref'].replace(
|
schema_name = response['$ref'].replace(
|
||||||
'#/components/responses/', '')
|
'#/components/responses/', '')
|
||||||
@ -697,7 +720,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
property_name +
|
property_name +
|
||||||
": Union[Unset, bool] = False\n")
|
": Union[Unset, bool] = False\n")
|
||||||
else:
|
else:
|
||||||
raise (" unknown type: ", property_type)
|
raise Exception(" unknown type: ", property_type)
|
||||||
elif '$ref' in property_schema:
|
elif '$ref' in property_schema:
|
||||||
ref = property_schema['$ref'].replace(
|
ref = property_schema['$ref'].replace(
|
||||||
'#/components/schemas/', '')
|
'#/components/schemas/', '')
|
||||||
@ -708,7 +731,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
ref +
|
ref +
|
||||||
"] = UNSET\n")
|
"] = UNSET\n")
|
||||||
else:
|
else:
|
||||||
raise (" unknown schema: ", property_schema)
|
raise Exception(" unknown schema: ", property_schema)
|
||||||
|
|
||||||
# Finish writing the class.
|
# Finish writing the class.
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
@ -770,7 +793,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
property_name +
|
property_name +
|
||||||
"\n")
|
"\n")
|
||||||
else:
|
else:
|
||||||
raise (" unknown type: ", property_type)
|
raise Exception(" unknown type: ", property_type)
|
||||||
elif '$ref' in property_schema:
|
elif '$ref' in property_schema:
|
||||||
ref = property_schema['$ref'].replace(
|
ref = property_schema['$ref'].replace(
|
||||||
'#/components/schemas/', '')
|
'#/components/schemas/', '')
|
||||||
@ -789,7 +812,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
property_name +
|
property_name +
|
||||||
".value\n")
|
".value\n")
|
||||||
else:
|
else:
|
||||||
raise (" unknown schema: ", property_schema)
|
raise Exception(" unknown schema: ", property_schema)
|
||||||
|
|
||||||
# Finish writing the to_dict method.
|
# Finish writing the to_dict method.
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
@ -880,7 +903,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
else:
|
else:
|
||||||
print(" unknown type: ", property_type)
|
print(" unknown type: ", property_type)
|
||||||
raise
|
raise Exception(" unknown type: ", property_type)
|
||||||
elif '$ref' in property_schema:
|
elif '$ref' in property_schema:
|
||||||
ref = property_schema['$ref'].replace(
|
ref = property_schema['$ref'].replace(
|
||||||
'#/components/schemas/', '')
|
'#/components/schemas/', '')
|
||||||
@ -903,7 +926,7 @@ def generateType(path: str, name: str, schema: dict):
|
|||||||
f.write("\n")
|
f.write("\n")
|
||||||
else:
|
else:
|
||||||
print(" unknown schema: ", property_schema)
|
print(" unknown schema: ", property_schema)
|
||||||
raise
|
raise Exception(" unknown schema: ", property_schema)
|
||||||
|
|
||||||
# Finish writing the from_dict method.
|
# Finish writing the from_dict method.
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
@ -25,6 +25,10 @@ def _get_kwargs(
|
|||||||
|
|
||||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, ErrorMessage]]:
|
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, ErrorMessage]]:
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
response_200 = [
|
||||||
|
GPUDevice.from_dict(item)
|
||||||
|
for item in response.json()
|
||||||
|
]
|
||||||
return response_200
|
return response_200
|
||||||
if response.status_code == 401:
|
if response.status_code == 401:
|
||||||
response_401 = ErrorMessage.from_dict(response.json())
|
response_401 = ErrorMessage.from_dict(response.json())
|
||||||
|
Reference in New Issue
Block a user