Skip to content

Commit bdfcf7c

Browse files
ArtDuclaude
andcommitted
fix(mapping): add fallback for null formatId in tuple format injection
Add fallback logic to injectFormatIntoTuples, getTuplesWithInjectedFormat, and getBatchTuplesWithInjectedFormat methods. When formatId is null and only one format is available, use that format instead of null. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 03fb07c commit bdfcf7c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tarantool-jackson-mapping/src/main/java/io/tarantool/mapping/TarantoolJacksonMappingWithoutTargetType.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ private static SelectResponse<List<Tuple<List<?>>>> injectFormatIntoTuples(
104104
for (Tuple<?> tuple : resp.get()) {
105105
Integer formatId = tuple.getFormatId();
106106
List<Field> format = formats.get(formatId);
107+
if (formatId == null && formats.size() == 1) {
108+
format = formats.values().stream().findFirst().get();
109+
}
107110
tuple.setFormat(format);
108111
}
109112
}
@@ -187,6 +190,9 @@ private static List<Tuple<List<?>>> getTuplesWithInjectedFormat(
187190
for (Tuple<?> tuple : tuples) {
188191
Integer formatId = tuple.getFormatId();
189192
List<Field> format = formats.get(formatId);
193+
if (formatId == null && formats.size() == 1) {
194+
format = formats.values().stream().findFirst().get();
195+
}
190196
tuple.setFormat(format);
191197
}
192198
}
@@ -216,6 +222,9 @@ private static CrudBatchResponse<List<Tuple<List<?>>>> getBatchTuplesWithInjecte
216222
for (Tuple<?> tuple : tuples) {
217223
Integer formatId = tuple.getFormatId();
218224
List<Field> format = formats.get(formatId);
225+
if (formatId == null && formats.size() == 1) {
226+
format = formats.values().stream().findFirst().get();
227+
}
219228
tuple.setFormat(format);
220229
}
221230
}

0 commit comments

Comments
 (0)