Skip to content

Serialize JSONObject in MappedObject - #399

Merged
zliang-akamai merged 4 commits into
devfrom
zhiwei/serialize-jsonobject-in-mappedobject
Apr 18, 2024
Merged

Serialize JSONObject in MappedObject#399
zliang-akamai merged 4 commits into
devfrom
zhiwei/serialize-jsonobject-in-mappedobject

Conversation

@zliang-akamai

@zliang-akamai zliang-akamai commented Apr 17, 2024

Copy link
Copy Markdown
Member

📝 Description

This is to fully serialize a JSONObject in MappedObject's dict property.

✔️ How to Test

Automated Testing

make testunit

Manual Testing

import os
from linode_api4 import LinodeClient


client = LinodeClient(os.getenv("LINODE_TOKEN"))

vpc = client.vpcs.create(
    "my-vpc",
    "us-mia",
    subnets=[{"label": "my-subnet", "ipv4": "10.0.0.0/24"}],
)

instance, _ = client.linode.instance_create(
    ltype="g6-nanode-1",
    region="us-mia",
    image="linode/ubuntu22.04",
    label="my-ubuntu-linode22",
    interfaces=[
        {
            "purpose": "vpc",
            "subnet_id": vpc.subnets[0].id,
        },
    ],
)

print(instance.ips.dict)

instance.delete()
vpc.delete()

Verify the vpc IP addresses list now contain valid dict, rather than a JSONObject object.

@zliang-akamai
zliang-akamai requested a review from a team as a code owner April 17, 2024 21:28
@zliang-akamai
zliang-akamai requested review from yec-akamai and ykim-akamai and removed request for a team April 17, 2024 21:28
@zliang-akamai zliang-akamai added the enhancement issues that request a enhancement label Apr 17, 2024
@zliang-akamai zliang-akamai changed the title Serialize JSONObject inMappedObject Serialize JSONObject in MappedObject Apr 17, 2024

@lgarber-akamai lgarber-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, nice work!

@yec-akamai yec-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works well on my end!

@zliang-akamai
zliang-akamai merged commit b0920fd into dev Apr 18, 2024
@zliang-akamai
zliang-akamai deleted the zhiwei/serialize-jsonobject-in-mappedobject branch April 18, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement issues that request a enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants