adobe / aio-lib-java-cloudmanager

Java wrapper to the Adobe Cloud Manager API.
https://opensource.adobe.com/aio-lib-java-cloudmanager/
Apache License 2.0
3 stars 9 forks source link

Expose getDelegate for non-serializable wrappers around Swagger models #24

Closed kwin closed 3 years ago

kwin commented 3 years ago

Although all Swagger model classes are serializable the wrapper classes in io.adobe.cloudmanager.model are not. E.g. PipelineExecutionStepState contains a reference towards CloudManagerApi which is not serializable. For all those wrapper classes the delegate should be exposed via a public getDelegate() method, because otherwise consumers cannot get hold of the serializable model instance.

bstopp commented 3 years ago

The classes in the the package io.adobe.cloudmanager.model all extend from their Swagger delegate classes, so they are serializable. Though, the serialVersionUID was missing and is now added via #28.

The lombok @Delegate annotation exposes all of the public methods from the delegate class, therefore there should be no reason to ever access the Delegate object itself. Adding the serialVersionUID should solve any persistence issues.

Please let me know if this doesn't in fact, resolve this issue.

kwin commented 3 years ago

This won't work, as the field client (https://github.com/adobe/aio-lib-java-cloudmanager/blob/1ac71fba9023f953e63ad5bcf0ee4fda2e3c5dca/src/main/java/io/adobe/cloudmanager/model/PipelineExecutionStepState.java#L44) is still not serializable!

It would be good to add a unit test to check that all models are serializable (e.g. by using https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/SerializationUtils.html#serialize-java.io.Serializable-java.io.OutputStream- and https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/SerializationUtils.html#deserialize-java.io.InputStream-)