[netatmo] Compatibility with OpenHAB 3 (Update to newer Swagger version and code generation libraries replaced) (#8274) (#8652)

Swagger upgrade for the Netatmo binding (required to use the OAS 3 Swagger annotations, the old annotations dependencies were removed with OpenHAB 3)
- Swagger-Codegen updated to the latest version (to generate the OAS 3 Swagger annotations)
- Retrofit replaced by the default code generation (Retrofit 1 code generation is broken with newer swagger-codegen versions and an update to Retrofit 2 is also incompatible and would require more dependencies)
- NULL handling for collections introduced (newer versions of the Swagger codegen return NULL for empty collections instead of an empty collection ...)
- The binding is now working completely again (compiles and starts), but there are still some TODOs

Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
sven.strohschein@gmail.com>
This commit is contained in:
Sven Strohschein
2020-10-04 12:07:23 +02:00
committed by GitHub
parent d2e5f71009
commit f24f4971d6
20 changed files with 249 additions and 166 deletions

View File

@@ -15,7 +15,7 @@
<name>openHAB Add-ons :: Bundles :: Netatmo Binding</name>
<properties>
<dep.noembedding>com.squareup.okhttp.okhttp,com.squareup.okio.okio-1.3.0,com.squareup.retrofit.retrofit,org.apache.oltu.oauth2.client,org.apache.oltu.oauth2.common</dep.noembedding>
<bnd.importpackage>!android.*,!com.android.org.*,!org.apache.harmony.*,!sun.*,!org.apache.oltu.*</bnd.importpackage>
</properties>
<dependencies>
@@ -26,21 +26,39 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>com.squareup.okhttp.okhttp</artifactId>
<version>2.3.0</version>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>logging-interceptor</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>com.squareup.okio.okio-1.3.0</artifactId>
<version>1.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>com.squareup.retrofit.retrofit</artifactId>
<version>1.9.0</version>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.8.4</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -55,14 +73,20 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.1.6</version>
<version>3.0.21</version>
<executions>
<execution>
<goals>
@@ -71,9 +95,13 @@
<configuration>
<inputSpec>https://raw.githubusercontent.com/cbornet/netatmo-swagger-decl/35e27745fb0d432bc6c8b5ec7a83ed2a09944cea/spec/swagger.yaml</inputSpec>
<language>java</language>
<library>retrofit</library>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<sourceFolder>src/main/java</sourceFolder>
<java8>true</java8>
<dateLibrary>java8-localdatetime</dateLibrary>
<useRuntimeException>true</useRuntimeException>
</configOptions>
</configuration>
</execution>