-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Jakarta JAXB 3 annotations, JAXB also updated internally
dependencies versions specified using `<dependencyManagement>`
- Loading branch information
1 parent
2c16098
commit 8b7ef48
Showing
8 changed files
with
166 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
67 changes: 67 additions & 0 deletions
67
typescript-generator-core/src/test/java/cz/habarta/typescript/generator/JaxbV3Test.java
This file contains 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,67 @@ | ||
|
||
package cz.habarta.typescript.generator; | ||
|
||
import jakarta.xml.bind.JAXBElement; | ||
import jakarta.xml.bind.annotation.XmlElement; | ||
import jakarta.xml.bind.annotation.XmlElementRef; | ||
import jakarta.xml.bind.annotation.XmlRootElement; | ||
import jakarta.xml.bind.annotation.XmlTransient; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
|
||
public class JaxbV3Test { | ||
|
||
@Test | ||
public void test() { | ||
final Settings settings = TestUtils.settings(); | ||
settings.jsonLibrary = JsonLibrary.jaxb; | ||
final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(MyJaxbBean.class)); | ||
Assertions.assertTrue(output.contains("king")); | ||
Assertions.assertFalse(output.contains("age")); | ||
} | ||
|
||
@XmlRootElement | ||
private static class MyJaxbBean { | ||
|
||
@XmlElement(name = "king") | ||
public String name; | ||
|
||
@XmlTransient | ||
public int age; | ||
|
||
} | ||
|
||
@Test | ||
public void testJAXBElement() { | ||
final Settings settings = TestUtils.settings(); | ||
settings.jsonLibrary = JsonLibrary.jaxb; | ||
final String output = new TypeScriptGenerator(settings).generateTypeScript(Input.from(ClassWithJAXBElements.class)); | ||
Assertions.assertTrue(output.contains("ExternalReference: string")); | ||
Assertions.assertTrue(output.contains("UserInformation: UserType")); | ||
Assertions.assertTrue(output.contains("Source: EndPointType")); | ||
Assertions.assertTrue(output.contains("AdditionalContextInfo: AdditionalContextType")); | ||
} | ||
|
||
@XmlRootElement | ||
private static class ClassWithJAXBElements { | ||
@XmlElement(name = "ExternalReference") | ||
protected String externalReference; | ||
@XmlElementRef(name = "UserInformation", type = JAXBElement.class, required = false) | ||
protected JAXBElement<UserType> userInformation; | ||
@XmlElementRef(name = "Source", type = JAXBElement.class, required = false) | ||
protected JAXBElement<EndPointType> source; | ||
@XmlElementRef(name = "AdditionalContextInfo", type = JAXBElement.class, required = false) | ||
protected JAXBElement<AdditionalContextType> additionalContextInfo; | ||
} | ||
|
||
private static class UserType { | ||
} | ||
|
||
private static class EndPointType { | ||
} | ||
|
||
private static class AdditionalContextType { | ||
} | ||
|
||
} |
This file contains 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