Skip to content

Commit 8257786

Browse files
committed
[#1369] Add @SuppressWarnings to generated client classes
1 parent 3d7a51d commit 8257786

File tree

14 files changed

+432
-0
lines changed

14 files changed

+432
-0
lines changed

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/template/QuteTemplatingEngineAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class QuteTemplatingEngineAdapter extends AbstractTemplatingEngineAdapter
1313

1414
private static final String IDENTIFIER = "qute";
1515
private static final String[] DEFAULT_TEMPLATES = {
16+
"suppressWarnings.qute",
1617
"additionalEnumTypeAnnotations.qute",
1718
"additionalEnumTypeUnexpectedMember.qute",
1819
"additionalModelTypeAnnotations.qute",

client/deployment/src/main/resources/templates/libraries/microprofile/api.qute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {imp.import};
2828
{#for apiAnnotation in additionalApiTypeAnnotations.orEmpty}
2929
{apiAnnotation}
3030
{/for}
31+
{#include suppressWarnings.qute/}
3132
public interface {classname} {
3233

3334
{#for op in operations.operation}

client/deployment/src/main/resources/templates/libraries/microprofile/auth/compositeAuthenticationProvider.qute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package {apiPackage}.auth;
2222
@io.quarkiverse.openapi.generator.markers.ApiKeyAuthenticationMarker(name="{auth.name}", openApiSpecId="{quarkus-generator.openApiSpecId}", apiKeyIn=io.quarkiverse.openapi.generator.providers.ApiKeyIn.cookie, apiKeyName="{auth.keyParamName}")
2323
{/if}
2424
{/for}
25+
{#include suppressWarnings.qute/}
2526
public class CompositeAuthenticationProvider implements jakarta.ws.rs.client.ClientRequestFilter {
2627

2728
@jakarta.inject.Inject

client/deployment/src/main/resources/templates/libraries/microprofile/auth/headersFactory.qute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package {apiPackage}.auth;
22

3+
{#include suppressWarnings.qute/}
34
public class AuthenticationPropagationHeadersFactory extends io.quarkiverse.openapi.generator.providers.AbstractAuthenticationPropagationHeadersFactory {
45

56
@jakarta.inject.Inject

client/deployment/src/main/resources/templates/libraries/microprofile/multipartFormdataPojo.qute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{#include suppressWarnings.qute/}
12
public static class {op.operationIdCamelCase}MultipartForm {
23
{#for p in op.formParams}
34
@jakarta.ws.rs.FormParam("{p.baseName}")

client/deployment/src/main/resources/templates/libraries/microprofile/pojo.qute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
2121
{#else}
2222
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
2323
{/if}
24+
{#include suppressWarnings.qute/}
2425
public class {m.classname} {#if m.parent}extends {m.parent}{/if}{#if serializableModel} implements java.io.Serializable{/if} {
2526

2627
{#for v in m.vars}

client/deployment/src/main/resources/templates/libraries/microprofile/pojoQueryParam.qute

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{/if}
66
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
77
{#include additionalModelTypeAnnotations.qute m=m/}
8+
{#include suppressWarnings.qute/}
89
public static class {m.classname}QueryParam {#if m.parent}extends {m.parent}{/if}{#if serializableModel} implements java.io.Serializable{/if} {
910

1011
{#for v in m.vars}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })

client/integration-tests/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<module>equals-hashcode</module>
5252
<module>override-credential-provider</module>
5353
<module>jsonproperty-getter-and-setter</module>
54+
<module>suppress-warnings</module>
5455
</modules>
5556
<dependencyManagement>
5657
<dependencies>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<parent>
4+
<artifactId>quarkus-openapi-generator-integration-tests</artifactId>
5+
<groupId>io.quarkiverse.openapi.generator</groupId>
6+
<version>3.0.0-SNAPSHOT</version>
7+
</parent>
8+
<modelVersion>4.0.0</modelVersion>
9+
10+
<artifactId>quarkus-openapi-generator-it-suppress-warnings</artifactId>
11+
<name>Quarkus - OpenAPI Generator - Integration Tests - Client - Suppress Warnings Test</name>
12+
<description>Ensures that generated classes have the @SuppressWarnings annotation</description>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>io.quarkiverse.openapi.generator</groupId>
17+
<artifactId>quarkus-openapi-generator</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.assertj</groupId>
21+
<artifactId>assertj-core</artifactId>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>io.quarkus</groupId>
26+
<artifactId>quarkus-junit5</artifactId>
27+
<scope>test</scope>
28+
</dependency><dependency>
29+
<groupId>com.github.javaparser</groupId>
30+
<artifactId>javaparser-symbol-solver-core</artifactId>
31+
<version>3.27.1</version>
32+
<scope>test</scope>
33+
</dependency>
34+
</dependencies>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>io.quarkus</groupId>
39+
<artifactId>quarkus-maven-plugin</artifactId>
40+
<extensions>true</extensions>
41+
<executions>
42+
<execution>
43+
<goals>
44+
<goal>build</goal>
45+
<goal>generate-code</goal>
46+
<goal>generate-code-tests</goal>
47+
</goals>
48+
</execution>
49+
</executions>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
<profiles>
54+
<profile>
55+
<id>native-image</id>
56+
<activation>
57+
<property>
58+
<name>native</name>
59+
</property>
60+
</activation>
61+
<build>
62+
<plugins>
63+
<plugin>
64+
<artifactId>maven-surefire-plugin</artifactId>
65+
<configuration>
66+
<skipTests>${native.surefire.skip}</skipTests>
67+
</configuration>
68+
</plugin>
69+
<plugin>
70+
<artifactId>maven-failsafe-plugin</artifactId>
71+
<executions>
72+
<execution>
73+
<goals>
74+
<goal>integration-test</goal>
75+
<goal>verify</goal>
76+
</goals>
77+
<configuration>
78+
<systemPropertyVariables>
79+
<native.image.path>
80+
${project.build.directory}/${project.build.finalName}-runner
81+
</native.image.path>
82+
<java.util.logging.manager>org.jboss.logmanager.LogManager
83+
</java.util.logging.manager>
84+
<maven.home>${maven.home}</maven.home>
85+
</systemPropertyVariables>
86+
</configuration>
87+
</execution>
88+
</executions>
89+
</plugin>
90+
</plugins>
91+
</build>
92+
<properties>
93+
<quarkus.package.type>native</quarkus.package.type>
94+
</properties>
95+
</profile>
96+
</profiles>
97+
98+
</project>

0 commit comments

Comments
 (0)