diff --git a/src/main/resources/swagger.api/schemas/bulk_operation_dto.json b/src/main/resources/swagger.api/schemas/bulk_operation_dto.json index c1b18a240..2d109a192 100644 --- a/src/main/resources/swagger.api/schemas/bulk_operation_dto.json +++ b/src/main/resources/swagger.api/schemas/bulk_operation_dto.json @@ -122,12 +122,24 @@ "format": "int64", "default": 0 }, + "matchedNumOfWarnings": { + "description": "Number of matching warnings", + "type": "integer", + "format": "int64", + "default": 0 + }, "committedNumOfErrors": { "description": "Number of committing errors", "type": "integer", "format": "int64", "default": 0 }, + "committedNumOfWarnings": { + "description": "Number of committing warnings", + "type": "integer", + "format": "int64", + "default": 0 + }, "executionChunkSize": { "description": "Size of chunk", "type": "integer", diff --git a/src/main/resources/swagger.api/schemas/error.json b/src/main/resources/swagger.api/schemas/error.json index 97a99a9ff..499bb7c53 100644 --- a/src/main/resources/swagger.api/schemas/error.json +++ b/src/main/resources/swagger.api/schemas/error.json @@ -7,8 +7,8 @@ "description": "Error message text" }, "type": { - "type": "string", - "description": "Error message type" + "description": "Error message type", + "$ref": "error_type.json#/ErrorType" }, "code": { "type": "string", @@ -18,6 +18,10 @@ "type": "object", "description": "Error message parameters", "$ref": "parameters.json" + }, + "field": { + "type": "string", + "description": "Name of failed field" } }, "additionalProperties": false, diff --git a/src/main/resources/swagger.api/schemas/error_type.json b/src/main/resources/swagger.api/schemas/error_type.json new file mode 100644 index 000000000..ccc49bf04 --- /dev/null +++ b/src/main/resources/swagger.api/schemas/error_type.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Type of error", + "ErrorType": { + "type": "string", + "enum": [ + "ERROR", + "WARNING" + ], + "default": "ERROR" + } +} diff --git a/src/test/java/org/folio/bulkops/service/ErrorServiceTest.java b/src/test/java/org/folio/bulkops/service/ErrorServiceTest.java index ea2540870..243b6101d 100644 --- a/src/test/java/org/folio/bulkops/service/ErrorServiceTest.java +++ b/src/test/java/org/folio/bulkops/service/ErrorServiceTest.java @@ -41,6 +41,7 @@ import org.folio.bulkops.domain.bean.RelatedInstanceInfo; import org.folio.bulkops.domain.bean.SrsRecord; import org.folio.bulkops.domain.dto.Error; +import org.folio.bulkops.domain.dto.ErrorType; import org.folio.bulkops.domain.dto.Errors; import org.folio.bulkops.domain.dto.IdentifierType; import org.folio.bulkops.domain.dto.OperationStatusType; @@ -407,8 +408,8 @@ private void mockErrorsData(OperationStatusType statusType, UUID operationId) { if (DATA_MODIFICATION == statusType || COMPLETED_WITH_ERRORS == statusType) { when(bulkEditClient.getErrorsPreview(any(UUID.class), anyInt())) .thenReturn(new Errors() - .errors(List.of(new Error().type("BULK_EDIT_ERROR").message("123,No match found"), - new Error().type("BULK_EDIT_ERROR").message("456,Invalid format")))); + .errors(List.of(new Error().type(ErrorType.ERROR).message("123,No match found"), + new Error().type(ErrorType.ERROR).message("456,Invalid format")))); } else { executionContentRepository.save(BulkOperationExecutionContent.builder() .bulkOperationId(operationId)