-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support properties with type
number
(#27)
* Removed `model.mustache` * Add support for type `number` * Add descriptions to Example Record with `number` fields
- Loading branch information
Showing
19 changed files
with
202 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{#isDeprecated}} | ||
|
||
@Deprecated{{/isDeprecated}} |
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/main/resources/templates/enum.mustache → ...in/resources/templates/modelEnum.mustache
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{{>javadoc}}{{#isDeprecated}} | ||
@Deprecated{{/isDeprecated}} | ||
{{^isEnum}}{{>record}}{{/isEnum}}{{#isEnum}}{{>enum}}{{/isEnum}} | ||
{{>javadoc}}{{>deprecation}} | ||
public record {{classname}}( | ||
{{#vars}}{{{datatypeWithEnum}}} {{name}}{{^-last}}, | ||
{{/-last}}{{/vars}}) { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/test/java/com/chrimle/example/TestExampleRecordWithNumberFields.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,32 @@ | ||
package com.chrimle.example; | ||
|
||
import com.chrimle.example.utils.AssertionUtils; | ||
import java.math.BigDecimal; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@DisplayName("Testing Record with Number fields") | ||
public class TestExampleRecordWithNumberFields { | ||
|
||
private final Class<?> classUnderTest = ExampleRecordWithNumberFields.class; | ||
|
||
@Test | ||
@DisplayName("Testing class generated is a Record") | ||
public void testClassGeneratedIsRecord() { | ||
AssertionUtils.assertIsRecord(classUnderTest); | ||
} | ||
|
||
@Test | ||
@DisplayName("Testing generated Record is not annotated as @Deprecated") | ||
public void testRecordIsNotAnnotatedAsDeprecated() { | ||
AssertionUtils.assertClassIsNotAnnotatedAsDeprecated(classUnderTest); | ||
} | ||
|
||
@Test | ||
@DisplayName("Testing generated Record has expected number of fields of expected types") | ||
public void testRecordHasNumberOfFieldsOfType() { | ||
AssertionUtils.assertRecordHasNumberOfFieldsOfType( | ||
classUnderTest, 3, BigDecimal.class); | ||
} | ||
|
||
} |
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
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
41 changes: 41 additions & 0 deletions
41
...-sources/openapi/src/gen/java/main/com/chrimle/example/ExampleRecordWithNumberFields.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,41 @@ | ||
/* | ||
* Example OpenAPI Spec. | ||
* An example OpenAPI-spec to generate example Java records. | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
* | ||
* This class was generated using custom mustache templates from | ||
* openapi-to-java-records-mustache-templates. For further information, | ||
* questions, requesting features or reporting issues, please visit: | ||
* https://github.com/Chrimle/openapi-to-java-records-mustache-templates. | ||
* | ||
*/ | ||
|
||
package com.chrimle.example; | ||
|
||
import java.util.Objects; | ||
import com.google.gson.TypeAdapter; | ||
import com.google.gson.annotations.JsonAdapter; | ||
import com.google.gson.annotations.SerializedName; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonWriter; | ||
import java.io.IOException; | ||
import java.math.BigDecimal; | ||
import java.util.Arrays; | ||
|
||
/** | ||
* Example of a Record with Number fields | ||
* @param field1 a Number field | ||
* @param field2 another Number field | ||
* @param field3 yet another Number field | ||
*/ | ||
public record ExampleRecordWithNumberFields( | ||
BigDecimal field1, | ||
BigDecimal field2, | ||
BigDecimal field3) { | ||
|
||
} |
Oops, something went wrong.