diff --git a/basyx.submodelrepository/basyx.submodelrepository-client/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/client/internal/SubmodelRepositoryApi.java b/basyx.submodelrepository/basyx.submodelrepository-client/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/client/internal/SubmodelRepositoryApi.java index 07b0466fc..c82cadd29 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-client/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/client/internal/SubmodelRepositoryApi.java +++ b/basyx.submodelrepository/basyx.submodelrepository-client/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/client/internal/SubmodelRepositoryApi.java @@ -301,10 +301,10 @@ public ApiResponse getSubmodelByIdMetadataWithHttpInfoNoUrlEncoding(St Submodel deserializedSubmodel = localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() { }); - if (deserializedSubmodel != null && deserializedSubmodel.getSubmodelElements() == null) - deserializedSubmodel.setSubmodelElements(Collections.emptyList()); + if (deserializedSubmodel != null && deserializedSubmodel.getSubmodelElements() != null && deserializedSubmodel.getSubmodelElements().isEmpty()) + deserializedSubmodel.setSubmodelElements(null); - return new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), deserializedSubmodel); + return new ApiResponse<>(localVarResponse.statusCode(), localVarResponse.headers().map(), deserializedSubmodel); } finally { } } catch (IOException e) {