Skip to content

model_dump missing "by_alias=True" #329

@jcbjoe

Description

@jcbjoe

It seems that the dump_model functions that are used do not have by_alias=True set. Which means some parameters on requests don't work. For example, /number/update, voice_callback_type is not converted to voiceCallbackType

Expected Behavior

The expected behaviour is that Pydantic should be using aliases when specified.
For example, /number/update voice_callback_type is sent as voice_callback_type and voice_callback_value is sent as voice_callback_value

Current Behavior

/number/update voice_callback_type should be sent as voiceCallbackType and voice_callback_value should be sent as voiceCallbackValue

Possible Solution

Adding by_alias=True to all model_dump invocations. Its a pretty easy change but Im not confident doing a large find + replace without having to test every single endpoint

Steps to Reproduce (for bugs)

        update_number_params = UpdateNumberParams(
                country="US",
                msisdn="EXAMPLE_NUMBER",
                voice_callback_type=VoiceCallbackType.SIP,
                voice_callback_value=f'SOME_SIP_ENDPOINT',
                mo_http_url=None,
                mo_smpp_sytem_type=None,
                voice_status_callback=None
            )
        print(update_number_params.model_dump(by_alias=True, exclude_unset=True))
        print(update_number_params.model_dump(by_alias=False, exclude_unset=True))

Context

This makes the SDK unusable for number provisioning for my usecase.

Your Environment

  • Version used: 4.6.0
  • Environment name and version (e.g. language and server version): Python 3.11.5
  • Operating System and version: MacOS Tahoe 26.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions