Skip to content

feat: Standardize hash/UUIDs allowed arguments #857

@dhorkel

Description

@dhorkel

While using the API, it is sometimes frustrating that some places expect a UUID as a UUID instance, others as a str and some accept either.

For example, EncordUserClient.get_storage_folder() accepts folder_uuid: Union[UUID, str] which it handles with:

if isinstance(folder_uuid, str):
    folder_uuid = UUID(folder_uuid)

but then StorageFolder.add_data_to_folder_job_cancel() only accepts a UUID in the argument upload_job_id: UUID

then in another method for the same class StorageFolder.add_private_data_to_folder_start() it only accepts a str for the argument integration_id: str, even though it just gets converted to a UUID in the private method StorageFolder._add_data_to_folder_start() so it can be passed to encord.orm.storage.PostUploadJobParams().

I believe the ideal solution would be to accept str | UUID in all public functions/methods.

There is also a related standardization issue of _uuid, _id and _hash being used in different places with no clear difference, but resolving this would likely be a breaking change not suitable for a minor version release.

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