Skip to content

[BUG] DDBClient does not generate an id for PutRequest when id is an empty string #191

@MohammedAghil

Description

@MohammedAghil

What is the bug?

The DDBClient implementation does not generate a new id in the case where an empty string is provided as the id. This is different from the LocalIndicesClient implementation where an Id is generated for both null or empty string.

DDB Client Existing Implementation

final String id = request.id() != null ? request.id() : UUID.randomUUID().toString();

Local Client Existing Implementation

if (!Strings.isNullOrEmpty(putDataObjectRequest.id())) {
    indexRequest.id(putDataObjectRequest.id());
}

How can one reproduce the bug?

Create a PutDataObjectRequest and provide id as an empty string, the operation will fail due to an error mentioning that the id is expected to be non-empty.

What is the expected behavior?

Similar to how the LocalIndicesClient implementation, the DDBClient implementation should also generate an id for both null and empty string.

Do you have any additional context?

The issue was noticed as part of onboarding opensearch alerting with the remote metadata sdk client

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions