Skip to content

Data Type mismatch in ReadingHistoryResponseBodyObject and the actual Response that api is giving #12

@pratiksha-fs

Description

@pratiksha-fs

we are getting string for value field from the response of api https://api.samsara.com/readings/history as given in https://developers.samsara.com/reference/getreadingshistory

But in the sdk code we are having dictionary as data Type which is breaking and giving error-
pydantic_core._pydantic_core.ValidationError: 18 validation errors for ReadingsGetReadingsHistoryResponseBody
data.0.value
Input should be a valid dictionary [type=dict_type, input_value='closed', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/dict_type

So i propose to change the in line https://github.com/samsarahq/samsara-python/blob/master/src/samsara/types/reading_history_response_body.py#L35

to make this

value: typing.Optional[str] = pydantic.Field(default=None)
"""
The value of the reading.
"""

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