Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #823: increase max number length limit to 100 (from 50) #826

Merged
merged 6 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
"""
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
"""
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
"""
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
"""
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 =
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand Down
Loading