Skip to content

Commit

Permalink
support default namespace for list api
Browse files Browse the repository at this point in the history
  • Loading branch information
nianliuu authored and rohanshah18 committed Oct 29, 2024
1 parent 7e8807d commit f41e4b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/pinecone/commons/IndexInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ W update(String id, List<Float> values, Struct metadata, String namespace, List<
default void validateListEndpointParameters(String namespace, String prefix, String paginationToken,
Integer limit, boolean namespaceRequired, boolean prefixRequired,
boolean paginationTokenRequired, boolean limitRequired) {
if (namespaceRequired && (namespace == null || namespace.isEmpty())) {
throw new PineconeValidationException("Namespace cannot be null or empty");
if (namespaceRequired && (namespace == null)) {
throw new PineconeValidationException("Namespace cannot be null");
}
if (prefixRequired && (prefix == null || prefix.isEmpty())) {
throw new PineconeValidationException("Prefix cannot be null or empty");
Expand Down
7 changes: 1 addition & 6 deletions src/test/java/io/pinecone/ListEndpointValidationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ public void testValidateListNamespace() throws IOException {
PineconeValidationException thrownNullNamespace = assertThrows(PineconeValidationException.class, () -> {
index.validateListEndpointParameters(null, null, null, null, true, true, true, true);
});
assertEquals("Namespace cannot be null or empty", thrownNullNamespace.getMessage());

PineconeValidationException thrownEmptyNamespace = assertThrows(PineconeValidationException.class, () -> {
index.validateListEndpointParameters("", null, null, null, true, true, true, true);
});
assertEquals("Namespace cannot be null or empty", thrownEmptyNamespace.getMessage());
assertEquals("Namespace cannot be null", thrownNullNamespace.getMessage());
}

@Test
Expand Down

0 comments on commit f41e4b8

Please sign in to comment.