-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[Java Jersey3] fix missing dependency for java jersey3 withXml option #24902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wing328
merged 6 commits into
OpenAPITools:master
from
MaikelBruin:feat/fix-java-jersey3-xml-dependency
Sep 10, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5bf56b3
[Java Jersey3] fix missing dependency for java jersey3 withXml option
bfb3e51
add test for pom template
eace784
Merge branch 'OpenAPITools:master' into feat/fix-java-jersey3-xml-dep…
MaikelBruin 8f2f56c
Revert "add test for pom template"
95a2008
reset java doc
50a8356
Merge branch 'OpenAPITools:master' into feat/fix-java-jersey3-xml-dep…
MaikelBruin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...generator/src/test/java/org/openapitools/codegen/java/jersey3/JavaJersey3WithXmlTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* | ||
| * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.openapitools.codegen.java.jersey3; | ||
|
|
||
| import org.openapitools.codegen.DefaultGenerator; | ||
| import org.openapitools.codegen.config.CodegenConfigurator; | ||
| import org.openapitools.codegen.languages.JavaClientCodegen; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import java.io.File; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.List; | ||
|
|
||
| import static org.testng.Assert.assertTrue; | ||
|
|
||
| /** | ||
| * Verifies that the jersey3 library supports the withXml option | ||
| * when {@code withXml=true} is set. | ||
| */ | ||
| public class JavaJersey3WithXmlTest { | ||
|
|
||
| private static final String PETSTORE_SPEC = "src/test/resources/3_0/petstore.yaml"; | ||
|
|
||
| @Test | ||
| public void jersey3WithXmlDoesNotThrow() throws Exception { | ||
| Path output = Files.createTempDirectory("jersey3-withXml-positive"); | ||
| output.toFile().deleteOnExit(); | ||
|
|
||
| List<File> files = generateWithXml(output); | ||
| assertTrue(!files.isEmpty(), "Generation should produce files"); | ||
| } | ||
|
|
||
| @Test | ||
| public void pomReferencesXmlArtifacts_Jackson2() throws Exception { | ||
| Path output = Files.createTempDirectory("jersey3-jackson2-xml-pom"); | ||
| output.toFile().deleteOnExit(); | ||
| generateWithXml(output); | ||
|
|
||
| String pom = Files.readString(output.resolve("pom.xml")); | ||
| //xml jackson2 libs | ||
| assertTrue(pom.contains("<groupId>com.fasterxml.jackson.dataformat</groupId>"), | ||
| "pom.xml should contain com.fasterxml.jackson.dataformat group"); | ||
| assertTrue(pom.contains("<artifactId>jackson-dataformat-xml</artifactId>"), | ||
| "pom.xml should contain jackson-dataformat-xml artifact"); | ||
| } | ||
|
|
||
| private List<File> generateWithXml(Path outputDir) { | ||
| CodegenConfigurator configurator = new CodegenConfigurator() | ||
| .setGeneratorName("java") | ||
| .setLibrary(JavaClientCodegen.JERSEY3) | ||
| .setInputSpec(PETSTORE_SPEC) | ||
| .setOutputDir(outputDir.toAbsolutePath().toString()); | ||
| configurator.addAdditionalProperty(JavaClientCodegen.WITH_XML, true); | ||
|
MaikelBruin marked this conversation as resolved.
|
||
| DefaultGenerator generator = new DefaultGenerator(); | ||
| generator.setGenerateMetadata(false); | ||
| return generator.opts(configurator.toClientOptInput()).generate(); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.