Skip to content
Open
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
25 changes: 23 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@
<includes>
<include>**/*Test.java</include>
</includes>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
-Djunit.jupiter.extensions.autodetection.enabled=true
</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -361,6 +370,18 @@
<scope>test</scope>
<version>${org.mockito.inline.version}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.15.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.15.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
Expand Down Expand Up @@ -412,8 +433,8 @@
<org.junit.platform.version>1.8.2</org.junit.platform.version>
<org.hamcrest.version>2.2</org.hamcrest.version>
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
<org.mockito.inline.version>4.6.1</org.mockito.inline.version>
<org.mockito.junit.jupiter.version>4.5.1</org.mockito.junit.jupiter.version>
<org.mockito.inline.version>5.2.0</org.mockito.inline.version>
<org.mockito.junit.jupiter.version>5.2.0</org.mockito.junit.jupiter.version>
<org.projectlombok.lombok-mapstruct-binding.version>0.2.0</org.projectlombok.lombok-mapstruct-binding.version>
<org.projectlombok.version>1.18.32</org.projectlombok.version>
<org.slf4j.version>2.0.17</org.slf4j.version>
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/mindee/parsing/v2/field/ObjectField.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ public LinkedHashMap<String, SimpleField> getSimpleFields() throws IllegalStateE
return simpleFields;
}

/**
* Retrieves all subfields from the {@code fields} map as a {@link LinkedHashMap} of
* {@code ListField} objects, keyed by their field names.
*
* @return a {@link LinkedHashMap} containing the field names as keys and their corresponding
* {@code ListField} instances as values (only includes fields that are list fields)
*/
public LinkedHashMap<String, ListField> getListFields() {
LinkedHashMap<String, ListField> listFields = new LinkedHashMap<>();
if (fields != null) {
for (String fieldName : fields.keySet()) {
DynamicField field = fields.get(fieldName);
if (field != null && field.getType() == DynamicField.FieldType.LIST_FIELD) {
listFields.put(fieldName, field.getListField());
}
}
}
return listFields;
}

@Override
public String toString() {
return "\n" + (fields != null ? fields.toString(1) : "");
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/mindee/MindeeSettingsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MindeeSettingsTest {
@SetEnvironmentVariable(key = "MINDEE_API_URL", value = "https://example.com")
void setEnvironmentVariablesAndEmptyParams() {
MindeeSettings settings = new MindeeSettings("", "");
Assertions.assertEquals(settings.getApiKey().orElse(""), "abcd");
Assertions.assertEquals(settings.getBaseUrl(), "https://example.com");
Assertions.assertEquals("abcd", settings.getApiKey().orElse(""));
Assertions.assertEquals("https://example.com", settings.getBaseUrl());
}
}
2 changes: 1 addition & 1 deletion src/test/java/com/mindee/input/LocalResponseV2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class LocalResponseV2Test {
/**
* Real signature using fake secret key.
*/
String signature = "1df388c992d87897fe61dfc56c444c58fc3c7369c31e2b5fd20d867695e93e85";
String signature = "f390d9f7f57ac04f47b6309d8a40236b0182610804fc20e91b1f6028aaca07a7";

/**
* File which the signature applies to.
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/mindee/parsing/v2/InferenceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ void deepNestedFields_mustExposeCorrectTypes() throws IOException {
InferenceFields lvl1 = fieldObject.getFields();
assertNotNull(lvl1.get("sub_object_list").getListField());
assertNotNull(lvl1.get("sub_object_object").getObjectField());
assertEquals(1, lvl1.get("sub_object_object").getObjectField().getListFields().size());

ObjectField subObjectObject = lvl1.get("sub_object_object").getObjectField();
InferenceFields lvl2 = subObjectObject.getFields();
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources
Submodule resources updated 32 files
+ v1/products/multi_receipts_detector/default_sample_180.jpg
+ v1/products/multi_receipts_detector/default_sample_270.jpg
+ v1/products/multi_receipts_detector/default_sample_90.jpg
+2 −2 v1/products/multi_receipts_detector/response_v1/complete.json
+310 −0 v1/products/multi_receipts_detector/response_v1/complete_180.json
+310 −0 v1/products/multi_receipts_detector/response_v1/complete_270.json
+310 −0 v1/products/multi_receipts_detector/response_v1/complete_90.json
+7 −0 v2/errors/error_401_invalid_api_key.json
+7 −0 v2/errors/error_401_missing_credentials.json
+3 −0 v2/inference/deep_nested_fields.json
+3 −0 v2/inference/rag_matched.json
+3 −0 v2/inference/rag_not_matched.json
+3 −0 v2/inference/raw_texts.json
+3 −0 v2/inference/standard_field_types.json
+36 −33 v2/inference/text_context_enabled.json
+3 −0 v2/products/financial_document/blank.json
+3 −0 v2/products/financial_document/complete.json
+3 −0 v2/products/financial_document/complete_with_coordinates.json
+3 −0 v2/products/financial_document/default_sample.json
+22 −0 v2/utilities/classification/classification_single.json
+ v2/utilities/classification/default_invoice.jpg
+69 −0 v2/utilities/crop/crop_multiple.json
+45 −0 v2/utilities/crop/crop_single.json
+ v2/utilities/crop/default_sample.jpg
+ v2/utilities/crop/multipage_sample.pdf
+ v2/utilities/ocr/default_sample.jpg
+23,136 −0 v2/utilities/ocr/ocr_multiple.json
+6,431 −0 v2/utilities/ocr/ocr_single.json
+ v2/utilities/split/default_sample.pdf
+ v2/utilities/split/invoice_5p.pdf
+42 −0 v2/utilities/split/split_multiple.json
+28 −0 v2/utilities/split/split_single.json
Loading