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