Skip to content

Commit f41e4b8

Browse files
nianliuurohanshah18
authored andcommitted
support default namespace for list api
1 parent 7e8807d commit f41e4b8

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/main/java/io/pinecone/commons/IndexInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,8 @@ W update(String id, List<Float> values, Struct metadata, String namespace, List<
734734
default void validateListEndpointParameters(String namespace, String prefix, String paginationToken,
735735
Integer limit, boolean namespaceRequired, boolean prefixRequired,
736736
boolean paginationTokenRequired, boolean limitRequired) {
737-
if (namespaceRequired && (namespace == null || namespace.isEmpty())) {
738-
throw new PineconeValidationException("Namespace cannot be null or empty");
737+
if (namespaceRequired && (namespace == null)) {
738+
throw new PineconeValidationException("Namespace cannot be null");
739739
}
740740
if (prefixRequired && (prefix == null || prefix.isEmpty())) {
741741
throw new PineconeValidationException("Prefix cannot be null or empty");

src/test/java/io/pinecone/ListEndpointValidationTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ public void testValidateListNamespace() throws IOException {
4040
PineconeValidationException thrownNullNamespace = assertThrows(PineconeValidationException.class, () -> {
4141
index.validateListEndpointParameters(null, null, null, null, true, true, true, true);
4242
});
43-
assertEquals("Namespace cannot be null or empty", thrownNullNamespace.getMessage());
44-
45-
PineconeValidationException thrownEmptyNamespace = assertThrows(PineconeValidationException.class, () -> {
46-
index.validateListEndpointParameters("", null, null, null, true, true, true, true);
47-
});
48-
assertEquals("Namespace cannot be null or empty", thrownEmptyNamespace.getMessage());
43+
assertEquals("Namespace cannot be null", thrownNullNamespace.getMessage());
4944
}
5045

5146
@Test

0 commit comments

Comments
 (0)