Skip to content

Bug: pto_state Literal type in IdlingEventObjectV20251023ResponseBody causes validation errors #35

@olivej

Description

@olivej

When calling client.idling.get_idling_events(), a Pydantic validation error is raised for every returned event:

pydantic_core._pydantic_core.ValidationError: 200 validation errors for AdvancedIdlingGetIdlingEventsResponseBody data.0.pto_state Input should be 'active, inactive' [type=literal_error, input_value='inactive', input_type=str]

The API correctly returns "ptoState": "inactive" (or active), but the SDK rejects it.

In samsara/types/idling_event_object_v_20251023_response_body.py, the pto_state field is defined as:

pto_state: typing_extensions.Annotated[typing.Literal["active, inactive"], FieldMetadata(alias="ptoState")]

The Literal type contains a single string "active, inactive" rather than two separate valid values.

I believe changing the type definition to the following would resolve the issue:

pto_state: typing_extensions.Annotated[typing.Literal["active", "inactive"], FieldMetadata(alias="ptoState")]

My Environment:

  • samsara-api version: 4.2.0
  • Python version: 3.13

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