Skip to content

Commit b7ac9b7

Browse files
committed
fix: E2E generator templates for Elixir Access and Java nullability
Fix Elixir helper template to use Map.get instead of bracket Access on DocumentNode structs. Fix Java helper template hasGeometry param from primitive boolean to nullable Boolean.
1 parent faa3430 commit b7ac9b7

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

e2e/elixir/test/support/e2e_helpers.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ defmodule E2E.Helpers do
485485

486486
node_type =
487487
if content do
488-
(if is_struct(content), do: Map.get(content, :node_type), else: nil) ||
488+
if(is_struct(content), do: Map.get(content, :node_type), else: nil) ||
489489
Map.get(content, :node_type) || Map.get(content, "node_type")
490490
else
491491
Map.get(node, :node_type) || Map.get(node, "node_type")

tools/e2e-generator/src/elixir.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,16 @@ defmodule E2E.Helpers do
469469
if is_boolean(opts[:has_groups]) do
470470
has_group_nodes =
471471
Enum.any?(nodes, fn node ->
472-
content = node[:content] || node["content"]
473-
node_type = if content, do: content[:node_type] || content["node_type"], else: node[:node_type] || node["node_type"]
472+
content = Map.get(node, :content) || Map.get(node, "content")
473+
474+
node_type =
475+
if content do
476+
(if is_struct(content), do: Map.get(content, :node_type), else: nil) ||
477+
Map.get(content, :node_type) || Map.get(content, "node_type")
478+
else
479+
Map.get(node, :node_type) || Map.get(node, "node_type")
480+
end
481+
474482
node_type == "group"
475483
end)
476484

tools/e2e-generator/src/java.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,15 +481,15 @@ public final class E2EHelpers {
481481
public static void assertOcrElements(
482482
ExtractionResult result,
483483
boolean hasElements,
484-
boolean hasGeometry,
484+
Boolean hasGeometry,
485485
Boolean hasConfidence,
486486
Integer minCount
487487
) {
488488
var ocrElements = result.getOcrElements();
489489
if (hasElements) {
490490
assertTrue(!ocrElements.isEmpty(), "Expected OCR elements, but none found");
491491
}
492-
if (hasGeometry) {
492+
if (hasGeometry != null && hasGeometry) {
493493
for (int i = 0; i < ocrElements.size(); i++) {
494494
assertNotNull(ocrElements.get(i).getGeometry(),
495495
String.format("OCR element %d expected to have geometry", i));

0 commit comments

Comments
 (0)