diff --git a/src/main/java/io/stargate/sgv2/jsonapi/api/model/command/deserializers/FilterClauseDeserializer.java b/src/main/java/io/stargate/sgv2/jsonapi/api/model/command/deserializers/FilterClauseDeserializer.java index 03387fe166..38be684d1e 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/api/model/command/deserializers/FilterClauseDeserializer.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/api/model/command/deserializers/FilterClauseDeserializer.java @@ -377,6 +377,12 @@ private static Object jsonNodeValue(JsonNode node) { throw new JsonApiException( ErrorCode.INVALID_FILTER_EXPRESSION, "Date value has to be sent as epoch time"); } + } else { + // handle an invalid filter use case: + // { "address": { "street": { "$xx": xxx } } } + throw new JsonApiException( + ErrorCode.INVALID_FILTER_EXPRESSION, + String.format("Invalid use of %s operator", node.fields().next().getKey())); } } else { ObjectNode objectNode = (ObjectNode) node; diff --git a/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java b/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java index afca17a9dd..bbae514ca6 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java @@ -25,7 +25,7 @@ public enum ErrorCode { FILTER_FIELDS_LIMIT_VIOLATION("Filter fields size limitation violated"), - INVALID_REQUST("Request not supported by the data store"), + INVALID_REQUEST("Request not supported by the data store"), INVALID_INDEXING_DEFINITION("Invalid indexing definition"), diff --git a/src/main/java/io/stargate/sgv2/jsonapi/exception/mappers/ThrowableToErrorMapper.java b/src/main/java/io/stargate/sgv2/jsonapi/exception/mappers/ThrowableToErrorMapper.java index 6c970c0f93..0f695bc62f 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/exception/mappers/ThrowableToErrorMapper.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/exception/mappers/ThrowableToErrorMapper.java @@ -72,7 +72,7 @@ public final class ThrowableToErrorMapper { if (message.contains("vector