Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade openapi-generator to v7.10.0 #40

Merged
merged 3 commits into from
Jan 22, 2025
Merged

Conversation

ctreatma
Copy link
Contributor

No description provided.

@ctreatma ctreatma requested review from a team as code owners January 17, 2025 15:23
Comment on lines +313 to +318
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes like these in the API classes are a result of OpenAPITools/openapi-generator#19025, which enables overriding the Accept header

@@ -39,7 +39,7 @@ print(AccessPoint.to_json())
# convert the object into a dict
access_point_dict = access_point_instance.to_dict()
# create an instance of AccessPoint from a dict
access_point_form_dict = access_point.from_dict(access_point_dict)
access_point_from_dict = AccessPoint.from_dict(access_point_dict)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes in the docs are a result of OpenAPITools/openapi-generator#18359, which fixes invalid code samples in docs.

Comment on lines +7 to +11
* `COLO` (value: `'COLO'`)

* `VD` (value: `'VD'`)

* `NETWORK` (value: `'NETWORK'`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These kinds of changes are a result of OpenAPITools/openapi-generator#18804, which includes supported enum values in the docs for enum models

Comment on lines +83 to +85
for _item_data in self.data:
if _item_data:
_items.append(_item_data.to_dict())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sorts of changes are a result of OpenAPITools/openapi-generator#19223, which fixes a potential bug when models contain multiple list attributes with different element types.

Comment on lines +268 to +270
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes add support for multiple file parameters; I suspect this isn't relevant to us but it should be backwards-compatible anyway since the str type is still a member of the updated union type. OpenAPITools/openapi-generator#19329

@@ -65,6 +67,7 @@ class ApiClient:
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'decimal': decimal.Decimal,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decimal support added in OpenAPITools/openapi-generator#19203

@@ -312,7 +316,7 @@ def response_deserialize(
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
encoding = match.group(1) if match else "utf-8"
response_text = response_data.data.decode(encoding)
return_data = self.deserialize(response_text, response_type)
return_data = self.deserialize(response_text, response_type, content_type)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for issues with deserialization not matching the specified content type: OpenAPITools/openapi-generator#18800

@@ -332,9 +336,11 @@ def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object.

If obj is None, return None.
If obj is SecretStr, return obj.get_secret_value()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for handling credentials & other sensitive strings, which would previously crash: OpenAPITools/openapi-generator#18023

Comment on lines +168 to +187
_default: ClassVar[Optional[Self]] = None

def __init__(
self,
host: Optional[str]=None,
api_key: Optional[Dict[str, str]]=None,
api_key_prefix: Optional[Dict[str, str]]=None,
username: Optional[str]=None,
password: Optional[str]=None,
access_token: Optional[str]=None,
server_index: Optional[int]=None,
server_variables: Optional[ServerVariablesT]=None,
server_operation_index: Optional[Dict[int, int]]=None,
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
*,
debug: Optional[bool] = None,
) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stronger typing for Python configuration class: OpenAPITools/openapi-generator#20014

@@ -40,7 +40,7 @@ class CloudRouterActionsSearchFilter(BaseModel):
actual_instance: Optional[Union[CloudRouterActionsSearchExpression, CloudRouterActionsSearchOrFilter]] = None
else:
actual_instance: Any = None
any_of_schemas: List[str] = Field(default=Literal["CloudRouterActionsSearchExpression", "CloudRouterActionsSearchOrFilter"])
any_of_schemas: Set[str] = { "CloudRouterActionsSearchExpression", "CloudRouterActionsSearchOrFilter" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressing Pydantic warnings when serializing complex models: OpenAPITools/openapi-generator#17941

@ctreatma
Copy link
Contributor Author

Ansible collection E2E tests passing with this generator upgrade: https://github.com/equinix/ansible-collection-equinix/actions/runs/12912927895/job/36008933210

@ctreatma ctreatma merged commit 62dbc7d into main Jan 22, 2025
3 checks passed
@ctreatma ctreatma deleted the generator-upgrade branch January 22, 2025 17:37
Copy link
Contributor

This PR is included in version 0.8.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant