File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
src/main/java/com/saasquatch/jsonschemainferrer Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 1414import java .util .Collections ;
1515import java .util .HashSet ;
1616import java .util .Objects ;
17+ import java .util .Optional ;
1718import java .util .Set ;
1819import java .util .stream .Collectors ;
1920import javax .annotation .Nonnull ;
@@ -295,15 +296,9 @@ private Set<ObjectNode> getAnyOfsFromSamples(
295296 // Enums
296297 enumExtractionResults .stream ().map (this ::enumExtractionResultToSchema ).forEach (anyOfs ::add );
297298 // Objects
298- final ObjectNode resultForObjects = processObjects (objectNodes );
299- if (resultForObjects != null ) {
300- anyOfs .add (resultForObjects );
301- }
299+ Optional .ofNullable (processObjects (objectNodes )).ifPresent (anyOfs ::add );
302300 // Arrays
303- final ObjectNode resultForArrays = processArrays (arrayNodes );
304- if (resultForArrays != null ) {
305- anyOfs .add (resultForArrays );
306- }
301+ Optional .ofNullable (processArrays (arrayNodes )).ifPresent (anyOfs ::add );
307302 // Primitives
308303 anyOfs .addAll (processPrimitives (valueNodes ));
309304 postProcessAnyOfs (anyOfs );
You can’t perform that action at this time.
0 commit comments