diff --git a/CONFIGURATION.md b/CONFIGURATION.md index d74656ad80..f3c7205c3b 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -31,7 +31,7 @@ Here are some Stargate-relevant property groups that are necessary for correct s | `stargate.jsonapi.document.limits.max-property-path-length` | `int` | `250` | The maximum length of property paths in a document (segments and separating periods) | | `stargate.jsonapi.document.limits.max-object-properties` | `int` | `1000` | The maximum number of properties any single object in a document can contain. | | `stargate.jsonapi.document.limits.max-document-properties` | `int` | `2000` | The maximum total number of properties all objects in a document can contain. | -| `stargate.jsonapi.document.limits.max-number-length` | `int` | `50` | The maximum length (in characters) of a single number value in a document. | +| `stargate.jsonapi.document.limits.max-number-length` | `int` | `100` | The maximum length (in characters) of a single number value in a document. | | `stargate.jsonapi.document.limits.max-string-length-in-bytes` | `int` | `8000` | The maximum length (in bytes) of a single string value in a document. | | `stargate.jsonapi.document.limits.max-array-length` | `int` | `1000` | The maximum length (in elements) of a single array in a document. | | `stargate.jsonapi.document.limits.max-vector-embedding-length` | `int` | `4096` | The maximum length (in floats) of the $vector in a document. | diff --git a/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java b/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java index 16ca3487df..eda955e452 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java @@ -33,7 +33,7 @@ public interface DocumentLimitsConfig { int DEFAULT_MAX_DOC_PROPERTIES = 2000; /** Defines the default maximum length of a single Number value (in characters) */ - int DEFAULT_MAX_NUMBER_LENGTH = 50; + int DEFAULT_MAX_NUMBER_LENGTH = 100; /** Defines the default maximum length of individual property names in JSON documents */ int DEFAULT_MAX_PROPERTY_NAME_LENGTH = 100; diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/configuration/ObjectMapperConfigurationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/configuration/ObjectMapperConfigurationTest.java index 2194899acf..5ce5bb7e65 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/api/configuration/ObjectMapperConfigurationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/api/configuration/ObjectMapperConfigurationTest.java @@ -278,7 +278,7 @@ public void failForNonEmptyOptions() throws Exception { @Test public void failForTooLongNumbers() { - String tooLongNumStr = "1234567890".repeat(6); + String tooLongNumStr = "1234567890".repeat(11); String json = """ { diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndReplaceIntegrationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndReplaceIntegrationTest.java index af30e28c48..96da760975 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndReplaceIntegrationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndReplaceIntegrationTest.java @@ -699,8 +699,8 @@ public void tryReplaceWithTooLongNumber() { """; insertDoc(document); - // Max number length: 50; use 100 - String tooLongNumStr = "1234567890".repeat(10); + // Max number length: 100; use 110 + String tooLongNumStr = "1234567890".repeat(11); String json = """ { diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndUpdateIntegrationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndUpdateIntegrationTest.java index c474a86501..0e4a3990d6 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndUpdateIntegrationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/FindOneAndUpdateIntegrationTest.java @@ -984,8 +984,8 @@ public void tryUpdateWithTooLongNumber() { } """); - // Max number length: 50; use 100 - String tooLongNumStr = "1234567890".repeat(10); + // Max number length: 100; use 110 + String tooLongNumStr = "1234567890".repeat(11); String json = """ { diff --git a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java index da0fde02cb..2dacdd618a 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/api/v1/InsertIntegrationTest.java @@ -678,8 +678,8 @@ public void insertLongScientificNumber() { @Test public void tryInsertTooLongNumber() { - // Max number length: 50; use 60 - String tooLongNumStr = "1234567890".repeat(6); + // Max number length: 100; use 110 + String tooLongNumStr = "1234567890".repeat(11); String json = """ { @@ -707,7 +707,7 @@ public void tryInsertTooLongNumber() { .body( "errors[0].message", startsWith( - "Document size limitation violated: Number value length (60) exceeds the maximum allowed (50")); + "Document size limitation violated: Number value length (110) exceeds the maximum allowed (100")); } @Test @@ -1438,8 +1438,8 @@ public void emptyDocuments() { class InsertManyFailing { @Test public void tryInsertTooLongNumber() { - // Max number length: 50; use 100 - String tooLongNumStr = "1234567890".repeat(10); + // Max number length: 100; use 110 + String tooLongNumStr = "1234567890".repeat(11); String json = """ diff --git a/src/test/java/io/stargate/sgv2/jsonapi/service/shredding/ShredderDocLimitsTest.java b/src/test/java/io/stargate/sgv2/jsonapi/service/shredding/ShredderDocLimitsTest.java index 09c08932c7..2ed4df1af3 100644 --- a/src/test/java/io/stargate/sgv2/jsonapi/service/shredding/ShredderDocLimitsTest.java +++ b/src/test/java/io/stargate/sgv2/jsonapi/service/shredding/ShredderDocLimitsTest.java @@ -356,8 +356,8 @@ public void catchTooLongNumberValues() throws Exception { final ObjectNode doc = objectMapper.createObjectNode(); doc.put("_id", 123); ArrayNode arr = doc.putArray("arr"); - // Max 50, so 60 should fail - String numStr = "1234567890".repeat(6); + // Max 100, so use slightly above + String numStr = "1234567890".repeat(10) + ".0"; doc.put("number", new BigDecimal(numStr)); arr.add(numStr); @@ -367,7 +367,7 @@ public void catchTooLongNumberValues() throws Exception { assertThat(e) .isNotNull() .isInstanceOf(StreamConstraintsException.class) - .hasMessageStartingWith("Number value length (60) exceeds the maximum allowed (50"); + .hasMessageStartingWith("Number value length (101) exceeds the maximum allowed (100"); } // Different test in that it should NOT fail but work as expected (in