@ -67,7 +67,12 @@ def generatePaths(cwd: str, parser: OpenApiParser):
|
||||
generatePath(path, p, method, endpoint, data)
|
||||
|
||||
|
||||
def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict):
|
||||
def generatePath(
|
||||
path: str,
|
||||
name: str,
|
||||
method: str,
|
||||
endpoint: dict,
|
||||
data: dict):
|
||||
# Generate the path.
|
||||
file_name = camel_to_snake(endpoint['operationId']) + '.py'
|
||||
# Add the tag to the path if it exists.
|
||||
@ -199,7 +204,8 @@ def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict):
|
||||
ref +
|
||||
".from_dict(response.json())\n")
|
||||
elif '$ref' in response:
|
||||
schema_name = response['$ref'].replace('#/components/responses/', '')
|
||||
schema_name = response['$ref'].replace(
|
||||
'#/components/responses/', '')
|
||||
schema = data['components']['responses'][schema_name]
|
||||
if 'content' in schema:
|
||||
content = schema['content']
|
||||
@ -207,7 +213,8 @@ def generatePath(path: str, name: str, method: str, endpoint: dict, data: dict):
|
||||
if content_type == 'application/json':
|
||||
json = content[content_type]['schema']
|
||||
if '$ref' in json:
|
||||
ref = json['$ref'].replace('#/components/schemas/', '')
|
||||
ref = json['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
f.write(
|
||||
"\t\tresponse_" +
|
||||
response_code +
|
||||
@ -618,28 +625,28 @@ def generateType(path: str, name: str, schema: dict):
|
||||
continue
|
||||
|
||||
f.write(
|
||||
"\t" +
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = self." +
|
||||
property_name +
|
||||
"\n")
|
||||
elif property_type == 'integer':
|
||||
f.write(
|
||||
"\t" +
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = self." +
|
||||
property_name +
|
||||
"\n")
|
||||
elif property_type == 'number':
|
||||
f.write(
|
||||
"\t" +
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = self." +
|
||||
property_name +
|
||||
"\n")
|
||||
elif property_type == 'boolean':
|
||||
f.write(
|
||||
"\t" +
|
||||
"\t\t" +
|
||||
property_name +
|
||||
" = self." +
|
||||
property_name +
|
||||
@ -894,7 +901,8 @@ def getEndpointRefs(endpoint: dict, data: dict) -> [str]:
|
||||
if ref not in refs:
|
||||
refs.append(ref)
|
||||
elif '$ref' in response:
|
||||
schema_name = response['$ref'].replace('#/components/responses/', '')
|
||||
schema_name = response['$ref'].replace(
|
||||
'#/components/responses/', '')
|
||||
schema = data['components']['responses'][schema_name]
|
||||
if 'content' in schema:
|
||||
content = schema['content']
|
||||
@ -902,7 +910,8 @@ def getEndpointRefs(endpoint: dict, data: dict) -> [str]:
|
||||
if content_type == 'application/json':
|
||||
json = content[content_type]['schema']
|
||||
if '$ref' in json:
|
||||
ref = json['$ref'].replace('#/components/schemas/', '')
|
||||
ref = json['$ref'].replace(
|
||||
'#/components/schemas/', '')
|
||||
if ref not in refs:
|
||||
refs.append(ref)
|
||||
|
||||
|
@ -27,18 +27,18 @@ class AuthSession:
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
email = self.email
|
||||
id = self.id
|
||||
image = self.image
|
||||
ip_address = self.ip_address
|
||||
is_valid = self.is_valid
|
||||
token = self.token
|
||||
user_id = self.user_id
|
||||
email = self.email
|
||||
id = self.id
|
||||
image = self.image
|
||||
ip_address = self.ip_address
|
||||
is_valid = self.is_valid
|
||||
token = self.token
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if created_at is not UNSET:
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if created_at is not UNSET:
|
||||
field_dict['created_at'] = created_at
|
||||
if email is not UNSET:
|
||||
field_dict['email'] = email
|
||||
|
@ -17,14 +17,14 @@ class ErrorMessage:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
code = self.code
|
||||
message = self.message
|
||||
status = self.status
|
||||
code = self.code
|
||||
message = self.message
|
||||
status = self.status
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if code is not UNSET:
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if code is not UNSET:
|
||||
field_dict['code'] = code
|
||||
if message is not UNSET:
|
||||
field_dict['message'] = message
|
||||
|
@ -33,10 +33,10 @@ class FileConversion:
|
||||
created_at: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.created_at, Unset):
|
||||
created_at = self.created_at.isoformat()
|
||||
id = self.id
|
||||
output = self.output
|
||||
output_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
id = self.id
|
||||
output = self.output
|
||||
output_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.output_format, Unset):
|
||||
output_format = self.output_format.value
|
||||
src_format: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.src_format, Unset):
|
||||
|
@ -19,16 +19,16 @@ class GPUDevice:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
memory_bus_width = self.memory_bus_width
|
||||
memory_clock_rate = self.memory_clock_rate
|
||||
name = self.name
|
||||
peak_memory_bandwidth = self.peak_memory_bandwidth
|
||||
id = self.id
|
||||
memory_bus_width = self.memory_bus_width
|
||||
memory_clock_rate = self.memory_clock_rate
|
||||
name = self.name
|
||||
peak_memory_bandwidth = self.peak_memory_bandwidth
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict['id'] = id
|
||||
if memory_bus_width is not UNSET:
|
||||
field_dict['memory_bus_width'] = memory_bus_width
|
||||
|
@ -26,24 +26,24 @@ class Instance:
|
||||
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
cpu_platform = self.cpu_platform
|
||||
description = self.description
|
||||
environment: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment.value
|
||||
git_hash = self.git_hash
|
||||
hostname = self.hostname
|
||||
id = self.id
|
||||
image = self.image
|
||||
ip_address = self.ip_address
|
||||
machine_type = self.machine_type
|
||||
name = self.name
|
||||
zone = self.zone
|
||||
cpu_platform = self.cpu_platform
|
||||
description = self.description
|
||||
environment: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment.value
|
||||
git_hash = self.git_hash
|
||||
hostname = self.hostname
|
||||
id = self.id
|
||||
image = self.image
|
||||
ip_address = self.ip_address
|
||||
machine_type = self.machine_type
|
||||
name = self.name
|
||||
zone = self.zone
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if cpu_platform is not UNSET:
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if cpu_platform is not UNSET:
|
||||
field_dict['cpu_platform'] = cpu_platform
|
||||
if description is not UNSET:
|
||||
field_dict['description'] = description
|
||||
|
Reference in New Issue
Block a user