Skip to content

Conversation

@zliang-akamai
Copy link
Member

📝 Description

  • Introduced alias_of parameter in Property to allow aliasing of API attributes.
  • Implemented properties_with_alias method in Base class to retrieve aliased properties.
  • Updated BetaProgram to include an aliased property for "class".
  • Added comprehensive tests for alias functionality in PropertyAliasTest.

✔️ How to Test

make test-unit

- Introduced `alias_of` parameter in Property to allow aliasing of API attributes.
- Implemented `properties_with_alias` method in Base class to retrieve aliased properties.
- Updated BetaProgram to include an aliased property for "class".
- Added comprehensive tests for alias functionality in PropertyAliasTest.
@zliang-akamai zliang-akamai requested a review from a team as a code owner November 19, 2025 03:15
@zliang-akamai zliang-akamai requested review from ezilber-akamai and yec-akamai and removed request for a team November 19, 2025 03:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for property aliasing in the Property class, allowing Python-friendly names for API attributes that are reserved words (like "class"). The implementation includes a new alias_of parameter, a properties_with_alias cached property for efficient lookup, and updates to serialization/deserialization logic to handle the mapping between aliased and original attribute names.

Key Changes:

  • Added alias_of parameter to Property class for mapping Python-safe names to original API attributes
  • Implemented properties_with_alias cached property in Base class for retrieving aliased properties
  • Updated _populate and _serialize methods to correctly handle aliased properties during JSON deserialization and serialization

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
linode_api4/objects/base.py Added alias support infrastructure including the alias_of parameter, properties_with_alias cached property, and updated serialization/population logic
linode_api4/objects/beta.py Added example usage with beta_class property aliasing the reserved word "class"
test/unit/objects/property_alias_test.py Comprehensive test suite covering alias functionality including population, serialization, multiple aliases, and edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

Nice work!

zliang-akamai and others added 2 commits November 26, 2025 13:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Nice work!

@zliang-akamai zliang-akamai merged commit 5d395d4 into linode:dev Dec 1, 2025
12 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/alias-support-in-property branch December 1, 2025 15:05
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.

4 participants