Skip to content

Commit d08c4ab

Browse files
committed
[fix][jaxrs-cxf-client] Added missing cli option to enable Jackson Annotation
1 parent f9f5af5 commit d08c4ab

4 files changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
invoker.goals = -nsu clean generate-sources
2+
# The expected result of the build, possible values are "success" (default) and "failure"
3+
invoker.buildResult = success
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2022 OpenAPI-Generator Contributors (https://openapi-generator.tech)
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
<modelVersion>4.0.0</modelVersion>
21+
22+
<groupId>org.openapitools.maven.its</groupId>
23+
<artifactId>jaxrs-cxf-client-issue5077</artifactId>
24+
<version>1.0-SNAPSHOT</version>
25+
26+
<properties>
27+
<maven.javadoc.skip>true</maven.javadoc.skip>
28+
</properties>
29+
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-compiler-plugin</artifactId>
35+
<version>3.10.0</version>
36+
<configuration>
37+
<source>11</source>
38+
<target>11</target>
39+
</configuration>
40+
</plugin>
41+
<plugin>
42+
<groupId>@project.groupId@</groupId>
43+
<artifactId>@project.artifactId@</artifactId>
44+
<version>@project.version@</version>
45+
<configuration>
46+
<inputSpec>https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml</inputSpec>
47+
<generatorName>jaxrs-cxf-client</generatorName>
48+
<dateLibrary>java8</dateLibrary>
49+
<output>${basedir}/out</output>
50+
<configOptions>
51+
<jackson>true</jackson>
52+
</configOptions>
53+
</configuration>
54+
<executions>
55+
<execution>
56+
<id>remote</id>
57+
<phase>generate-sources</phase>
58+
<goals>
59+
<goal>generate</goal>
60+
</goals>
61+
</execution>
62+
</executions>
63+
</plugin>
64+
</plugins>
65+
</build>
66+
</project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
File mavenPomXml = new File(basedir, "out/pom.xml")
18+
assert mavenPomXml.isFile()
19+
20+
File petModel = new File(basedir, "out/src/gen/java/org/openapitools/model/Pet.java")
21+
assert petModel.isFile()
22+
assert petModel.text.contains("import com.fasterxml.jackson.annotation.JsonCreator;")
23+
assert petModel.text.contains("import com.fasterxml.jackson.annotation.JsonValue;")
24+
assert petModel.text.contains("@JsonCreator")
25+
assert petModel.text.contains("@JsonValue")

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ public AbstractJavaCodegen() {
317317
cliOptions.add(CliOption.newBoolean(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC, this.isHideGenerationTimestamp()));
318318
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)"));
319319
cliOptions.add(CliOption.newBoolean(USE_ONE_OF_INTERFACES, "whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface"));
320+
cliOptions.add(CliOption.newBoolean(JACKSON, "Enable Jackson annotation as serialization library."));
320321

321322
CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use").defaultValue(this.getDateLibrary());
322323
Map<String, String> dateOptions = new HashMap<>();

0 commit comments

Comments
 (0)