-
Notifications
You must be signed in to change notification settings - Fork 70
Add limitation in the array of events for the endpoint of generate #227
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
Changes from 1 commit
7b6619b
8cfe96f
df0942f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,13 @@ public class RemremGenerateController { | |
@Value("${lenientValidationEnabledToUsers:false}") | ||
private boolean lenientValidationEnabledToUsers; | ||
|
||
@Value("${maxEventsOfInputArray:250}") | ||
private int maxSize; | ||
|
||
public void setMaxSize(int maxSize) { | ||
this.maxSize = maxSize; | ||
} | ||
|
||
public void setLenientValidationEnabledToUsers(boolean lenientValidationEnabledToUsers) { | ||
this.lenientValidationEnabledToUsers = lenientValidationEnabledToUsers; | ||
} | ||
|
@@ -159,6 +166,14 @@ public ResponseEntity<?> generate(final String msgProtocol, final String msgType | |
|
||
if (inputData.isJsonArray()) { | ||
JsonArray inputEventJsonArray = inputData.getAsJsonArray(); | ||
|
||
if (inputEventJsonArray.size() > maxSize) { | ||
return createResponseEntity(HttpStatus.BAD_REQUEST, JSON_ERROR_STATUS, | ||
"The number of events in the input array is exceeded the allowed limit of 250 events. " + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use real values, not hard-coded ones. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
"This issue occurred because the input array contains more than 250 events, which is not supported by the system. " | ||
+ "To resolve this, please divide the events in to smaller arrays, ensuring each array contains no more than 250 events," | ||
+ "and try to generate them again. This limitation helps to maintain system performance and stability."); | ||
} | ||
for (JsonElement element : inputEventJsonArray) { | ||
JsonObject generatedEvent = (processEvent(msgProtocol, msgType, | ||
failIfMultipleFound, failIfNoneFound, lookupInExternalERs, lookupLimit, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,7 @@ event-repository.enabled: false | |
event-repository.url: http://<host>:<port>/<context-path-if-available> | ||
|
||
# lenientValidationEnabledToUsers true will perform the validation only on mandatory fields, non-mandatory validation failures add into Eiffel message as property remremGenerateFailures | ||
lenientValidationEnabledToUsers: false | ||
lenientValidationEnabledToUsers: false | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maximum number of templates in array passed to /xxx endpoint. Please, replace xxx by real endpoint name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
#Maximum size of events in array is fetched from REMReM property and checked during publishing. | ||
maxEventsOfInputArray: 250 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the variable to be more expressive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done