xero-python icon indicating copy to clipboard operation
xero-python copied to clipboard

Can't serialize value type 'UUID'

Open howieweiner opened this issue 1 year ago • 2 comments

Hi. I've just started using the xero-python SDK (v 6.3.0) to retrieve Invoices. There appears to be an issue in the client when serializing UUID fields

This code:

response = accounting_api.get_invoice(XERO_TENANT_ID, invoice_id)

throws a ValueError `Can't serialize value type 'UUID' when attempting to serialize the model.

I've resolved this issue by patching the serializer based on this suggestion in Issue #93

@serialize_model.register(UUID)
def serialize_uuid_model(model):
    """Serializes api model into an json serializable object.

    :param model: BaseModel instance to serialize
    :return: serialized object
    """
    return model.hex
    ```

howieweiner avatar Oct 21 '24 15:10 howieweiner

PETOSS-653

github-actions[bot] avatar Oct 21 '24 15:10 github-actions[bot]

Thanks for raising an issue, a ticket has been created to track your request

github-actions[bot] avatar Oct 21 '24 15:10 github-actions[bot]