Added field and class level annotations to the pojo.mustache (#11775)

* Added field and class level annotations

Added x-class-extra-annotation and x-field-extra-annotation for class and field level annotations per object/field

* added field and class level extra annotations to pojos

* Updated samples

* Removed duplicate line

* Updated samples
This commit is contained in:
Jason Froehlich 2022-03-13 09:55:25 -04:00 committed by GitHub
parent 7ac90ed98f
commit a3c5bbb09a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
190 changed files with 924 additions and 177 deletions

View File

@ -15,6 +15,9 @@
{{/isClassnameSanitized}} {{/isClassnameSanitized}}
{{/jackson}} {{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
{{#serializableModel}} {{#serializableModel}}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -63,6 +66,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#gson}} {{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}} {{#isContainer}}
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();

View File

@ -37,6 +37,9 @@ import javax.json.bind.annotation.JsonbCreator;
**/ **/
{{/description}} {{/description}}
{{>additionalModelTypeAnnotations}} {{>additionalModelTypeAnnotations}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}}{{#isEnum}}{{^isContainer}} {{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
@ -52,6 +55,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
{{^withXml}} {{^withXml}}
@JsonbProperty("{{baseName}}") @JsonbProperty("{{baseName}}")
{{/withXml}} {{/withXml}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}} {{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}} {{/isContainer}}

View File

@ -15,6 +15,9 @@ import {{invokerPackage}}.JSON;
}) })
{{/jackson}} {{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
{{#serializableModel}} {{#serializableModel}}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -63,6 +66,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#gson}} {{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}} {{#isContainer}}
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();

View File

@ -34,6 +34,9 @@ import {{invokerPackage}}.JSON;
{{/isClassnameSanitized}} {{/isClassnameSanitized}}
{{/jackson}} {{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
{{#serializableModel}} {{#serializableModel}}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -80,6 +83,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#gson}} {{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}} {{#isContainer}}
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();

View File

@ -15,6 +15,9 @@
{{/isClassnameSanitized}} {{/isClassnameSanitized}}
{{/jackson}} {{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
{{#serializableModel}} {{#serializableModel}}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -61,6 +64,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
{{#gson}} {{#gson}}
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}} {{#isContainer}}
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();

View File

@ -6,12 +6,18 @@ import javax.xml.bind.annotation.*;
{{/withXml}} {{/withXml}}
{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} {{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}}{{#isEnum}}{{^isContainer}} {{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}} {{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}} {{/isContainer}}

View File

@ -25,6 +25,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/ */
@ApiModel(description="{{{description}}}") @ApiModel(description="{{{description}}}")
{{/description}}{{>additionalModelTypeAnnotations}} {{/description}}{{>additionalModelTypeAnnotations}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}}{{#isEnum}}{{^isContainer}} {{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
@ -45,6 +48,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensi
{{#isDateTime}} {{#isDateTime}}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss.SSSX") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm:ss.SSSX")
{{/isDateTime}} {{/isDateTime}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}} {{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}} {{/isContainer}}

View File

@ -16,7 +16,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
**/ **/
@ApiModel(description="{{{description}}}") @ApiModel(description="{{{description}}}")
{{/description}} {{/description}}
{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { {{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{#vendorExtensions.x-implements}}{{#-first}} implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}}{{#isEnum}}{{^isContainer}} {{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
@ -30,6 +34,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* {{{.}}} * {{{.}}}
**/ **/
{{/description}} {{/description}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}} {{#isContainer}}
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();

View File

@ -10,6 +10,9 @@
}) })
{{/jackson}} {{/jackson}}
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}} {{#vars}}
{{#isEnum}} {{#isEnum}}
@ -30,6 +33,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}";
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}} {{#isContainer}}
private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}};
{{/isContainer}} {{/isContainer}}

View File

@ -1,6 +1,9 @@
import io.swagger.annotations.*; import io.swagger.annotations.*;
{{#description}}@ApiModel(description="{{{.}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} {{#description}}@ApiModel(description="{{{.}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#serializableModel}} {{#serializableModel}}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -10,7 +13,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}} private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
{{#vars}} {{#vars}}

View File

@ -1,6 +1,9 @@
import io.swagger.annotations.*; import io.swagger.annotations.*;
{{#description}}@ApiModel(description="{{{.}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} {{#description}}@ApiModel(description="{{{.}}}"){{/description}}{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#serializableModel}} {{#serializableModel}}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -10,6 +13,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}} private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
{{#vars}} {{#vars}}

View File

@ -12,12 +12,19 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
**/{{/description}} **/{{/description}}
{{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}} {{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}}
@JsonTypeName("{{name}}") @JsonTypeName("{{name}}")
{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { {{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}}{{#isEnum}}{{^isContainer}} {{#vars}}{{#isEnum}}{{^isContainer}}
{{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}}
{{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
private {{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}} private {{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}}
{{#vars}}/** {{#vars}}/**

View File

@ -7,6 +7,9 @@ import javax.validation.constraints.*;
*/ */
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#vars}} {{#vars}}
{{#isEnum}} {{#isEnum}}
@ -25,6 +28,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
{{#gson}} {{#gson}}
@SerializedName("{{baseName}}") @SerializedName("{{baseName}}")
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}} {{#isContainer}}
{{#useBeanValidation}} {{#useBeanValidation}}
{{>beanValidation}} {{>beanValidation}}

View File

@ -22,6 +22,9 @@
{{>xmlAnnotation}} {{>xmlAnnotation}}
{{/withXml}} {{/withXml}}
{{>generatedAnnotation}} {{>generatedAnnotation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}
public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{^parent}}{{#hateoas}}extends RepresentationModel<{{classname}}> {{/hateoas}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{^parent}}{{#hateoas}}extends RepresentationModel<{{classname}}> {{/hateoas}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} {
{{#serializableModel}} {{#serializableModel}}
@ -48,6 +51,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}}{{^parent}}{{#ha
{{#gson}} {{#gson}}
@SerializedName("{{baseName}}") @SerializedName("{{baseName}}")
{{/gson}} {{/gson}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#isContainer}} {{#isContainer}}
{{#useBeanValidation}}@Valid{{/useBeanValidation}} {{#useBeanValidation}}@Valid{{/useBeanValidation}}
{{#openApiNullable}} {{#openApiNullable}}

View File

@ -17,7 +17,10 @@
{{/additionalModelTypeAnnotations}} {{/additionalModelTypeAnnotations}}
{{>common/generatedAnnotation}}{{#discriminator}}{{>common/model/typeInfoAnnotation}}{{/discriminator}}{{>common/model/xmlAnnotation}}{{#useBeanValidation}} {{>common/generatedAnnotation}}{{#discriminator}}{{>common/model/typeInfoAnnotation}}{{/discriminator}}{{>common/model/xmlAnnotation}}{{#useBeanValidation}}
@Introspected @Introspected
{{/useBeanValidation}}{{! {{/useBeanValidation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{vendorExtensions.x-class-extra-annotation}}}
{{/vendorExtensions.x-class-extra-annotation}}{{!
Declare the class with extends and implements Declare the class with extends and implements
}}public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ }}public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{
{{#serializableModel}} {{#serializableModel}}
@ -57,6 +60,9 @@ Declare the class with extends and implements
{{/isContainer}} {{/isContainer}}
{{/isXmlAttribute}} {{/isXmlAttribute}}
{{/withXml}} {{/withXml}}
{{#vendorExtensions.x-field-extra-annotation}}
{{{vendorExtensions.x-field-extra-annotation}}}
{{/vendorExtensions.x-field-extra-annotation}}
{{#vendorExtensions.x-is-jackson-optional-nullable}} {{#vendorExtensions.x-is-jackson-optional-nullable}}
{{#isContainer}} {{#isContainer}}
private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined();

View File

@ -20,6 +20,7 @@ import io.swagger.v3.parser.core.models.ParseOptions;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile; import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile;
import org.openapitools.codegen.java.assertions.JavaFileAssert;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.openrewrite.maven.internal.RawPom; import org.openrewrite.maven.internal.RawPom;
import org.testng.Assert; import org.testng.Assert;
@ -36,6 +37,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import com.google.common.collect.ImmutableMap;
public class TestUtils { public class TestUtils {
/** /**
@ -237,4 +240,99 @@ public class TestUtils {
assertTrue(true); assertTrue(true);
} }
} }
public static void assertExtraAnnotationFiles(String baseOutputPath) {
JavaFileAssert.assertThat(java.nio.file.Paths.get(baseOutputPath + "/EmployeeEntity.java"))
.assertTypeAnnotations()
.containsWithName("javax.persistence.Entity")
.containsWithNameAndAttributes("javax.persistence.Table", ImmutableMap.of("name", "\"employees\""))
.toType()
.hasProperty("assignments")
.assertPropertyAnnotations()
.containsWithNameAndAttributes("javax.persistence.OneToMany", ImmutableMap.of("mappedBy", "\"employee\""))
.toProperty()
.toType();
JavaFileAssert.assertThat(java.nio.file.Paths.get(baseOutputPath + "/Employee.java"))
.assertTypeAnnotations()
.containsWithName("javax.persistence.MappedSuperclass")
.toType()
.hasProperty("id")
.assertPropertyAnnotations()
.containsWithName("javax.persistence.Id")
.toProperty()
.toType()
.hasProperty("email")
.assertPropertyAnnotations()
.containsWithName("org.hibernate.annotations.Formula")
.toProperty()
.toType()
.hasProperty("hasAcceptedTerms")
.assertPropertyAnnotations()
.containsWithName("javax.persistence.Transient")
.toProperty()
.toType();
JavaFileAssert.assertThat(java.nio.file.Paths.get(baseOutputPath + "/SurveyGroupEntity.java"))
.assertTypeAnnotations()
.containsWithName("javax.persistence.Entity")
.containsWithNameAndAttributes("javax.persistence.Table", ImmutableMap.of("name", "\"survey_groups\""))
.toType()
.hasProperty("assignments")
.assertPropertyAnnotations()
.containsWithName("javax.persistence.OneToMany")
.containsWithNameAndAttributes("javax.persistence.JoinColumn", ImmutableMap.of("name", "\"survey_group_id\""))
.toProperty()
.toType()
.hasProperty("disabled")
.assertPropertyAnnotations()
.containsWithNameAndAttributes("javax.persistence.Column", ImmutableMap.of("nullable", "false"))
.toProperty()
.toType();
JavaFileAssert.assertThat(java.nio.file.Paths.get(baseOutputPath + "/SurveyGroup.java"))
.assertTypeAnnotations()
.containsWithName("javax.persistence.MappedSuperclass")
.containsWithName("javax.persistence.EntityListeners")
.toType()
.hasProperty("id")
.assertPropertyAnnotations()
.containsWithName("javax.persistence.Id")
.containsWithNameAndAttributes("javax.persistence.GeneratedValue", ImmutableMap.of("generator", "\"UUID\""))
.containsWithNameAndAttributes("org.hibernate.annotations.GenericGenerator", ImmutableMap.of("name", "\"UUID\"","strategy", "\"org.hibernate.id.UUIDGenerator\""))
.containsWithNameAndAttributes("javax.persistence.Column", ImmutableMap.of("name", "\"id\"","updatable", "false","nullable", "false"))
.toProperty()
.toType()
.hasProperty("createdDate")
.assertPropertyAnnotations()
.containsWithName("org.springframework.data.annotation.CreatedDate")
.toProperty()
.toType()
.hasProperty("createdBy")
.assertPropertyAnnotations()
.containsWithName("org.springframework.data.annotation.CreatedBy")
.toProperty()
.toType()
.hasProperty("modifiedDate")
.assertPropertyAnnotations()
.containsWithName("org.springframework.data.annotation.LastModifiedDate")
.toProperty()
.toType()
.hasProperty("modifiedBy")
.assertPropertyAnnotations()
.containsWithName("org.springframework.data.annotation.LastModifiedBy")
.toProperty()
.toType()
.hasProperty("opportunityId")
.assertPropertyAnnotations()
.containsWithNameAndAttributes("javax.persistence.Column", ImmutableMap.of("unique", "true"))
.toProperty()
.toType()
.hasProperty("submissionStatus")
.assertPropertyAnnotations()
.containsWithName("javax.persistence.Transient")
.toProperty()
.toType();
}
} }

View File

@ -55,6 +55,7 @@ import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.config.CodegenConfigurator;
import org.openapitools.codegen.languages.AbstractJavaCodegen; import org.openapitools.codegen.languages.AbstractJavaCodegen;
import org.openapitools.codegen.languages.JavaClientCodegen; import org.openapitools.codegen.languages.JavaClientCodegen;
import org.openapitools.codegen.languages.features.CXFServerFeatures;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Ignore; import org.testng.annotations.Ignore;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -1309,4 +1310,103 @@ public class JavaClientCodegenTest {
"localVarQueryParams.addAll(ApiClient.parameterToPairs(\"maxWaitSecs\", queryObject.getMaxWaitSecs()));" "localVarQueryParams.addAll(ApiClient.parameterToPairs(\"maxWaitSecs\", queryObject.getMaxWaitSecs()));"
); );
} }
@Test
public void testExtraAnnotationsNative() throws IOException {
testExtraAnnotations(JavaClientCodegen.NATIVE);
}
@Test
public void testExtraAnnotationsJersey1() throws IOException {
testExtraAnnotations(JavaClientCodegen.JERSEY1);
}
@Test
public void testExtraAnnotationsJersey2() throws IOException {
testExtraAnnotations(JavaClientCodegen.JERSEY2);
}
@Test
public void testExtraAnnotationsMicroprofile() throws IOException {
testExtraAnnotations(JavaClientCodegen.MICROPROFILE);
}
@Test
public void testExtraAnnotationsOKHttpGSON() throws IOException {
testExtraAnnotations(JavaClientCodegen.OKHTTP_GSON);
}
@Test
public void testExtraAnnotationsVertx() throws IOException {
testExtraAnnotations(JavaClientCodegen.VERTX);
}
@Test
public void testExtraAnnotationsFeign() throws IOException {
testExtraAnnotations(JavaClientCodegen.FEIGN);
}
@Test
public void testExtraAnnotationsRetrofit2() throws IOException {
testExtraAnnotations(JavaClientCodegen.RETROFIT_2);
}
@Test
public void testExtraAnnotationsRestTemplate() throws IOException {
testExtraAnnotations(JavaClientCodegen.RESTTEMPLATE);
}
@Test
public void testExtraAnnotationsWebClient() throws IOException {
testExtraAnnotations(JavaClientCodegen.WEBCLIENT);
}
@Test
public void testExtraAnnotationsRestEasy() throws IOException {
testExtraAnnotations(JavaClientCodegen.RESTEASY);
}
@Test
public void testExtraAnnotationsGoogleApiClient() throws IOException {
testExtraAnnotations(JavaClientCodegen.GOOGLE_API_CLIENT);
}
@Test
public void testExtraAnnotationsRestAssured() throws IOException {
testExtraAnnotations(JavaClientCodegen.REST_ASSURED);
}
@Test
public void testExtraAnnotationsApache() throws IOException {
testExtraAnnotations(JavaClientCodegen.APACHE);
}
public void testExtraAnnotations(String library) throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
Map<String, Object> properties = new HashMap<>();
properties.put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("java")
.setLibrary(library)
.setAdditionalProperties(properties)
.setInputSpec("src/test/resources/3_0/issue_11772.yml")
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(clientOptInput).generate();
TestUtils.assertExtraAnnotationFiles(outputPath + "/src/main/java/org/openapitools/client/model");
}
} }

View File

@ -6,6 +6,7 @@ import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.parser.core.models.ParseOptions; import io.swagger.v3.parser.core.models.ParseOptions;
import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultGenerator; import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.MockDefaultGenerator; import org.openapitools.codegen.MockDefaultGenerator;
import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.TestUtils;
@ -271,4 +272,32 @@ public abstract class JavaJaxrsBaseTest {
Assert.assertTrue(operations.get("operation") instanceof List); Assert.assertTrue(operations.get("operation") instanceof List);
return (List<CodegenOperation>) operations.get("operation"); return (List<CodegenOperation>) operations.get("operation");
} }
@Test
public void testExtraAnnotations() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/issue_11772.yml");
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();
TestUtils.assertExtraAnnotationFiles(outputPath + "/src/gen/java/org/openapitools/model");
}
} }

View File

@ -5,6 +5,7 @@ import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.languages.JavaMicronautServerCodegen; import org.openapitools.codegen.languages.JavaMicronautServerCodegen;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -192,4 +193,14 @@ public class MicronautServerCodegenTest extends AbstractMicronautCodegenTest {
assertFileContains(modelPath + "Order.java", "public Order()"); assertFileContains(modelPath + "Order.java", "public Order()");
assertFileNotContainsRegex(modelPath + "Order.java", "public Order\\([^)]+\\)"); assertFileNotContainsRegex(modelPath + "Order.java", "public Order\\([^)]+\\)");
} }
@Test
public void testExtraAnnotations() throws Exception {
JavaMicronautServerCodegen codegen = new JavaMicronautServerCodegen();
String outputPath = generateFiles(codegen, "src/test/resources/3_0/issue_11772.yml", CodegenConstants.MODELS);
TestUtils.assertExtraAnnotationFiles(outputPath + "/src/main/java/org/openapitools/model");
}
} }

View File

@ -17,11 +17,21 @@
package org.openapitools.codegen.java.play; package org.openapitools.codegen.java.play;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.languages.JavaPlayFrameworkCodegen; import org.openapitools.codegen.languages.JavaPlayFrameworkCodegen;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.File;
import java.nio.file.Files;
public class JavaPlayFrameworkCodegenTest { public class JavaPlayFrameworkCodegenTest {
@Test @Test
@ -93,4 +103,34 @@ public class JavaPlayFrameworkCodegenTest {
Assert.assertEquals(codegen.getConfigPackage(), "xyz.yyyyy.cccc.config"); Assert.assertEquals(codegen.getConfigPackage(), "xyz.yyyyy.cccc.config");
Assert.assertEquals(codegen.additionalProperties().get(JavaPlayFrameworkCodegen.CONFIG_PACKAGE), "xyz.yyyyy.cccc.config"); Assert.assertEquals(codegen.additionalProperties().get(JavaPlayFrameworkCodegen.CONFIG_PACKAGE), "xyz.yyyyy.cccc.config");
} }
@Test
public void testExtraAnnotations() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/issue_11772.yml", null, new ParseOptions()).getOpenAPI();
JavaPlayFrameworkCodegen codegen = new JavaPlayFrameworkCodegen();
codegen.setOutputDir(output.getAbsolutePath());
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();
TestUtils.assertExtraAnnotationFiles(outputPath + "/app/apimodels");
}
} }

View File

@ -1164,4 +1164,34 @@ public class SpringCodegenTest {
.assertParameterAnnotations() .assertParameterAnnotations()
.containsWithNameAndAttributes("RequestParam", ImmutableMap.of("defaultValue", "\"true\"")); .containsWithNameAndAttributes("RequestParam", ImmutableMap.of("defaultValue", "\"true\""));
} }
@Test
public void testExtraAnnotations() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/issue_11772.yml", null, new ParseOptions()).getOpenAPI();
SpringCodegen codegen = new SpringCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();
TestUtils.assertExtraAnnotationFiles(outputPath + "/src/main/java/org/openapitools/model");
}
} }

View File

@ -0,0 +1,279 @@
openapi: 3.0.0
info:
title: Extra Annotation Test
version: 1.0.0
tags:
- name: employee
- name: surveyGroup
- name: skills
- name: surveySubmission
- name: userProfile
servers:
- url: "http://localhost:8080"
paths:
/employee:
get:
tags:
- employee
parameters:
- name: filterBy
description: Field by which to filter results.
in: query
schema:
type: string
example: name
- name: filter
description: String to filter on, query string
in: query
schema:
type: string
example: Frank
- name: sortBy
description: Field by which to sort
in: query
schema:
type: string
- name: sortOrder
description: Sort Order
in: query
schema:
type: string
enum:
- ASC
- DESC
- name: offset
description: Page offset
schema:
type: integer
format: int32
in: query
- name: maxResults
description: Maximum number of results to return, defaults to 20
schema:
type: integer
format: int32
example: 20
in: query
responses:
"200":
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Employee"
description: A list resource collection of Employees.
operationId: getEmployees
summary: List all employees.
components:
schemas:
EmployeeEntity:
type: object
x-class-extra-annotation: |-
@javax.persistence.Entity
@javax.persistence.Table(
name = "employees",
uniqueConstraints = {
@javax.persistence.UniqueConstraint(columnNames = {"email"})
}
)
allOf:
- $ref: "#/components/schemas/Employee"
properties:
assignments:
description: Projects for which the employee has been assigned to a SurveyGroup
items:
$ref: "#/components/schemas/EmployeeAssignment"
type: array
x-field-extra-annotation: |-
@javax.persistence.OneToMany(mappedBy = "employee")
Employee:
type: object
x-class-extra-annotation: |-
@javax.persistence.MappedSuperclass
properties:
id:
description: Employee's ID
type: string
example: jsmith@openapi.com
x-field-extra-annotation: |-
@javax.persistence.Id
name:
description: Name of the employee.
type: string
example: John Smith
email:
description: The email address of the employee.
type: string
example: jsmith@openapi.com
x-field-extra-annotation: |-
@org.hibernate.annotations.Formula("CONCAT(id, '@openapi.com')")
role:
description: "The role of the employee. For example, consultant, PM, TSM, etc."
type: string
example: Consultant
hasAcceptedTerms:
description: Whether the employee has accepted the terms of the usage agreement.
type: boolean
example: false
x-field-extra-annotation: |-
@javax.persistence.Transient
dateTermsAccepted:
description: The date the employee accepted the terms of the usage agreement.
type: string
format: date
example: "2021-02-09"
termsVersionNumber:
description: The version number of terms of the usage agreement.
type: number
format: float
example: 1.0
SurveyGroupEntity:
required:
- opportunityId
- projectName
- projectCreatorId
type: object
allOf:
- $ref: "#/components/schemas/SurveyGroup"
x-class-extra-annotation: |-
@javax.persistence.Entity
@javax.persistence.Table(name = "survey_groups")
properties:
assignments:
type: array
x-field-extra-annotation: |-
@javax.persistence.OneToMany
@javax.persistence.JoinColumn(name = "survey_group_id")
items:
$ref: "#/components/schemas/EmployeeAssignment"
disabled:
description: A flag indicating if this Survey Group is disabled
type: boolean
x-field-extra-annotation: |-
@javax.persistence.Column(nullable = false)
default: false
example: false
SurveyGroup:
required:
- opportunityId
- projectName
- projectCreatorId
- tsmId
type: object
x-class-extra-annotation: |-
@javax.persistence.MappedSuperclass
@javax.persistence.EntityListeners(org.springframework.data.jpa.domain.support.AuditingEntityListener.class)
properties:
id:
description: A GUID that uniquely identifies the SurveyGroup.
type: string
format: uuid
example: f1ad7649-eb70-4499-9c82-a63fe2c6dc71
x-field-extra-annotation: |-
@javax.persistence.Id
@javax.persistence.GeneratedValue(generator = "UUID")
@org.hibernate.annotations.GenericGenerator(name = "UUID", strategy =
"org.hibernate.id.UUIDGenerator")
@javax.persistence.Column(name = "id", updatable = false, nullable =
false)
createdDate:
description: The date the project was created.
type: string
format: date-time
readOnly: true
example: "2020-01-29"
x-field-extra-annotation: |-
@org.springframework.data.annotation.CreatedDate
createdBy:
description: The employee id (Kerberos) of the user that created the project.
type: string
example: janedoe
x-field-extra-annotation: |-
@org.springframework.data.annotation.CreatedBy
modifiedDate:
description: The date the project was last modified
type: string
format: date-time
readOnly: true
example: "2020-01-29"
x-field-extra-annotation: |-
@org.springframework.data.annotation.LastModifiedDate
modifiedBy:
description: The employee id (Kerberos) of the user that last modifed the project.
type: string
example: janedoe
x-field-extra-annotation: |-
@org.springframework.data.annotation.LastModifiedBy
opportunityId:
description: The ID of the Opportunity from PSA.
type: string
example: 3456NAS
x-field-extra-annotation: |-
@javax.persistence.Column(unique = true)
projectName:
description: The name of the project.
type: string
example: NASA App Modernization
projectCreatorId:
description: The email address of the creator of the project.
type: string
example: janedoe@openapi.com
submissionStatus:
x-field-extra-annotation: |-
@javax.persistence.Transient
description: Returns a status of "Complete" or "Incomplete"
type: string
example: Complete
enum:
- Complete
- Incomplete
EmployeeAssignment:
type: object
x-class-extra-annotation: |-
@javax.persistence.Entity
@javax.persistence.Table(
name = "employee_assignments",
uniqueConstraints={
@javax.persistence.UniqueConstraint(columnNames={"employee_id", "survey_group_id"})
})
properties:
id:
description: A GUID that uniquely identifies the project.
type: string
format: uuid
example: f9238beb-9649-4983-9059-4f0ee372d56e
x-field-extra-annotation: |-
@javax.persistence.Id
@javax.persistence.GeneratedValue(generator = "UUID")
@org.hibernate.annotations.GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
@javax.persistence.Column(name = "id", updatable = false, nullable = false)
employee:
allOf:
- $ref: "#/components/schemas/EmployeeEntity"
type: object
x-field-extra-annotation: |-
@javax.persistence.ManyToOne(cascade = javax.persistence.CascadeType.REMOVE)
@javax.persistence.JoinColumn(name = "employee_id", nullable=false)
surveyGroup:
description: The unique ID of the SurveyGroup associated with the opportunity.
type: object
x-field-extra-annotation: |-
@javax.persistence.ManyToOne
@javax.persistence.JoinColumn(name = "survey_group_id", nullable=false)
allOf:
- $ref: "#/components/schemas/SurveyGroupEntity"
startDate:
description: The date the employee started the project.
type: string
format: date-time
example: "2020-01-29"
endDate:
description: The employee's end date on the project.
type: string
format: date-time
example: "2020-01-29"
billableRole:
description: Role that the employee is billed for on the project..
type: string
example: Consultant

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A category for a pet * A category for a pet
**/ **/
@ApiModel(description="A category for a pet") @ApiModel(description="A category for a pet")
public class Category { public class Category {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
**/ **/
@ApiModel(description="Describes the result of uploading an image resource") @ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse { public class ModelApiResponse {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* An order for a pets from the pet store * An order for a pets from the pet store
**/ **/
@ApiModel(description="An order for a pets from the pet store") @ApiModel(description="An order for a pets from the pet store")
public class Order { public class Order {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -17,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A pet for sale in the pet store * A pet for sale in the pet store
**/ **/
@ApiModel(description="A pet for sale in the pet store") @ApiModel(description="A pet for sale in the pet store")
public class Pet { public class Pet {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A tag for a pet * A tag for a pet
**/ **/
@ApiModel(description="A tag for a pet") @ApiModel(description="A tag for a pet")
public class Tag { public class Tag {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A User who is purchasing from the pet store * A User who is purchasing from the pet store
**/ **/
@ApiModel(description="A User who is purchasing from the pet store") @ApiModel(description="A User who is purchasing from the pet store")
public class User { public class User {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A category for a pet * A category for a pet
**/ **/
@ApiModel(description="A category for a pet") @ApiModel(description="A category for a pet")
public class Category { public class Category {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
**/ **/
@ApiModel(description="Describes the result of uploading an image resource") @ApiModel(description="Describes the result of uploading an image resource")
public class ModelApiResponse { public class ModelApiResponse {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* An order for a pets from the pet store * An order for a pets from the pet store
**/ **/
@ApiModel(description="An order for a pets from the pet store") @ApiModel(description="An order for a pets from the pet store")
public class Order { public class Order {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -17,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A pet for sale in the pet store * A pet for sale in the pet store
**/ **/
@ApiModel(description="A pet for sale in the pet store") @ApiModel(description="A pet for sale in the pet store")
public class Pet { public class Pet {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A tag for a pet * A tag for a pet
**/ **/
@ApiModel(description="A tag for a pet") @ApiModel(description="A tag for a pet")
public class Tag { public class Tag {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A User who is purchasing from the pet store * A User who is purchasing from the pet store
**/ **/
@ApiModel(description="A User who is purchasing from the pet store") @ApiModel(description="A User who is purchasing from the pet store")
public class User { public class User {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesAnyType extends HashMap<String, Object> { public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesArray extends HashMap<String, List> { public class AdditionalPropertiesArray extends HashMap<String, List> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> { public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -10,6 +10,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesClass { public class AdditionalPropertiesClass {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesInteger extends HashMap<String, Integer> { public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> { public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesObject extends HashMap<String, Map> { public class AdditionalPropertiesObject extends HashMap<String, Map> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class AdditionalPropertiesString extends HashMap<String, String> { public class AdditionalPropertiesString extends HashMap<String, String> {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@JsonSubTypes.Type(value = Cat.class, name = "Cat"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"),
@JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Dog.class, name = "Dog"),
}) })
public class Animal { public class Animal {
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class ArrayOfArrayOfNumberOnly { public class ArrayOfArrayOfNumberOnly {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class ArrayOfNumberOnly { public class ArrayOfNumberOnly {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class ArrayTest { public class ArrayTest {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -10,6 +10,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class BigCat extends Cat { public class BigCat extends Cat {
public enum KindEnum { public enum KindEnum {

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class BigCatAllOf { public class BigCatAllOf {
public enum KindEnum { public enum KindEnum {

View File

@ -6,6 +6,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Capitalization { public class Capitalization {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Cat extends Animal { public class Cat extends Animal {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class CatAllOf { public class CatAllOf {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -6,6 +6,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Category { public class Category {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Model for testing model with \"_class\" property * Model for testing model with \"_class\" property
**/ **/
@ApiModel(description="Model for testing model with \"_class\" property") @ApiModel(description="Model for testing model with \"_class\" property")
public class ClassModel { public class ClassModel {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -6,6 +6,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Client { public class Client {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Dog extends Animal { public class Dog extends Animal {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class DogAllOf { public class DogAllOf {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -10,6 +10,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class EnumArrays { public class EnumArrays {
public enum JustSymbolEnum { public enum JustSymbolEnum {

View File

@ -10,6 +10,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class EnumTest { public class EnumTest {
public enum EnumStringEnum { public enum EnumStringEnum {

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class FileSchemaTestClass { public class FileSchemaTestClass {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class FormatTest { public class FormatTest {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class HasOnlyReadOnly { public class HasOnlyReadOnly {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class MapTest { public class MapTest {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class MixedPropertiesAndAdditionalPropertiesClass { public class MixedPropertiesAndAdditionalPropertiesClass {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Model for testing model name starting with number * Model for testing model name starting with number
**/ **/
@ApiModel(description="Model for testing model name starting with number") @ApiModel(description="Model for testing model name starting with number")
public class Model200Response { public class Model200Response {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class ModelApiResponse { public class ModelApiResponse {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Must be named `File` for test. * Must be named `File` for test.
**/ **/
@ApiModel(description="Must be named `File` for test.") @ApiModel(description="Must be named `File` for test.")
public class ModelFile { public class ModelFile {
@ApiModelProperty(value = "Test capitalization") @ApiModelProperty(value = "Test capitalization")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class ModelList { public class ModelList {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Model for testing reserved words * Model for testing reserved words
**/ **/
@ApiModel(description="Model for testing reserved words") @ApiModel(description="Model for testing reserved words")
public class ModelReturn { public class ModelReturn {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Model for testing model name same as property name * Model for testing model name same as property name
**/ **/
@ApiModel(description="Model for testing model name same as property name") @ApiModel(description="Model for testing model name same as property name")
public class Name { public class Name {
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class NumberOnly { public class NumberOnly {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Order { public class Order {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class OuterComposite { public class OuterComposite {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -15,6 +15,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Pet { public class Pet {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -6,6 +6,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class ReadOnlyFirst { public class ReadOnlyFirst {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -7,6 +7,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class SpecialModelName { public class SpecialModelName {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -6,6 +6,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class Tag { public class Tag {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class TypeHolderDefault { public class TypeHolderDefault {
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class TypeHolderExample { public class TypeHolderExample {
@ApiModelProperty(example = "what", required = true, value = "") @ApiModelProperty(example = "what", required = true, value = "")

View File

@ -6,6 +6,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class User { public class User {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")

View File

@ -9,6 +9,7 @@ import javax.validation.Valid;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class XmlItem { public class XmlItem {
@ApiModelProperty(example = "string", value = "") @ApiModelProperty(example = "string", value = "")

View File

@ -12,9 +12,7 @@ import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A category for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Category { public class Category {
private Long id; private Long id;
private String name; private String name;
/** /**

View File

@ -13,11 +13,8 @@ import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="Describes the result of uploading an image resource")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class ModelApiResponse { public class ModelApiResponse {
private Integer code; private Integer code;
private String type; private String type;
private String message; private String message;
/** /**

View File

@ -14,13 +14,9 @@ import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="An order for a pets from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Order { public class Order {
private Long id; private Long id;
private Long petId; private Long petId;
private Integer quantity; private Integer quantity;
private OffsetDateTime shipDate; private OffsetDateTime shipDate;
/** /**
@ -45,9 +41,7 @@ public class Order {
} }
} }
private StatusEnum status; private StatusEnum status;
private Boolean complete = false; private Boolean complete = false;
/** /**

View File

@ -17,15 +17,10 @@ import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A pet for sale in the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Pet { public class Pet {
private Long id; private Long id;
private Category category; private Category category;
private String name; private String name;
private List<String> photoUrls = new ArrayList<>(); private List<String> photoUrls = new ArrayList<>();
private List<Tag> tags = new ArrayList<>(); private List<Tag> tags = new ArrayList<>();
/** /**
@ -50,7 +45,6 @@ public class Pet {
} }
} }
private StatusEnum status; private StatusEnum status;
/** /**

View File

@ -12,9 +12,7 @@ import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A tag for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Tag { public class Tag {
private Long id; private Long id;
private String name; private String name;
/** /**

View File

@ -12,21 +12,13 @@ import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A User who is purchasing from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class User { public class User {
private Long id; private Long id;
private String username; private String username;
private String firstName; private String firstName;
private String lastName; private String lastName;
private String email; private String email;
private String password; private String password;
private String phone; private String phone;
private Integer userStatus; private Integer userStatus;
/** /**

View File

@ -12,9 +12,7 @@ import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A category for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Category { public class Category {
private Long id; private Long id;
private String name; private String name;
/** /**

View File

@ -13,11 +13,8 @@ import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="Describes the result of uploading an image resource")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class ModelApiResponse { public class ModelApiResponse {
private Integer code; private Integer code;
private String type; private String type;
private String message; private String message;
/** /**

View File

@ -14,13 +14,9 @@ import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="An order for a pets from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Order { public class Order {
private Long id; private Long id;
private Long petId; private Long petId;
private Integer quantity; private Integer quantity;
private DateTime shipDate; private DateTime shipDate;
/** /**
@ -45,9 +41,7 @@ public class Order {
} }
} }
private StatusEnum status; private StatusEnum status;
private Boolean complete = false; private Boolean complete = false;
/** /**

View File

@ -17,15 +17,10 @@ import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A pet for sale in the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Pet { public class Pet {
private Long id; private Long id;
private Category category; private Category category;
private String name; private String name;
private List<String> photoUrls = new ArrayList<>(); private List<String> photoUrls = new ArrayList<>();
private List<Tag> tags = new ArrayList<>(); private List<Tag> tags = new ArrayList<>();
/** /**
@ -50,7 +45,6 @@ public class Pet {
} }
} }
private StatusEnum status; private StatusEnum status;
/** /**

View File

@ -12,9 +12,7 @@ import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A tag for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Tag { public class Tag {
private Long id; private Long id;
private String name; private String name;
/** /**

View File

@ -12,21 +12,13 @@ import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A User who is purchasing from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class User { public class User {
private Long id; private Long id;
private String username; private String username;
private String firstName; private String firstName;
private String lastName; private String lastName;
private String email; private String email;
private String password; private String password;
private String phone; private String phone;
private Integer userStatus; private Integer userStatus;
/** /**

View File

@ -12,9 +12,7 @@ import io.swagger.annotations.*;
@ApiModel(description="A category for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A category for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Category { public class Category {
private Long id; private Long id;
private String name; private String name;
/** /**

View File

@ -13,11 +13,8 @@ import io.swagger.annotations.*;
@ApiModel(description="Describes the result of uploading an image resource")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="Describes the result of uploading an image resource")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class ModelApiResponse { public class ModelApiResponse {
private Integer code; private Integer code;
private String type; private String type;
private String message; private String message;
/** /**

View File

@ -14,13 +14,9 @@ import io.swagger.annotations.*;
@ApiModel(description="An order for a pets from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="An order for a pets from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Order { public class Order {
private Long id; private Long id;
private Long petId; private Long petId;
private Integer quantity; private Integer quantity;
private Date shipDate; private Date shipDate;
/** /**
@ -45,9 +41,7 @@ public class Order {
} }
} }
private StatusEnum status; private StatusEnum status;
private Boolean complete = false; private Boolean complete = false;
/** /**

View File

@ -17,15 +17,10 @@ import io.swagger.annotations.*;
@ApiModel(description="A pet for sale in the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A pet for sale in the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Pet { public class Pet {
private Long id; private Long id;
private Category category; private Category category;
private String name; private String name;
private List<String> photoUrls = new ArrayList<>(); private List<String> photoUrls = new ArrayList<>();
private List<Tag> tags = new ArrayList<>(); private List<Tag> tags = new ArrayList<>();
/** /**
@ -50,7 +45,6 @@ public class Pet {
} }
} }
private StatusEnum status; private StatusEnum status;
/** /**

View File

@ -12,9 +12,7 @@ import io.swagger.annotations.*;
@ApiModel(description="A tag for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A tag for a pet")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class Tag { public class Tag {
private Long id; private Long id;
private String name; private String name;
/** /**

View File

@ -12,21 +12,13 @@ import io.swagger.annotations.*;
@ApiModel(description="A User who is purchasing from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen") @ApiModel(description="A User who is purchasing from the pet store")@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen")
public class User { public class User {
private Long id; private Long id;
private String username; private String username;
private String firstName; private String firstName;
private String lastName; private String lastName;
private String email; private String email;
private String password; private String password;
private String phone; private String phone;
private Integer userStatus; private Integer userStatus;
/** /**

View File

@ -18,7 +18,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName("AdditionalPropertiesAnyType") @JsonTypeName("AdditionalPropertiesAnyType")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public class AdditionalPropertiesAnyType extends HashMap<String, Object> implements Serializable { @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> implements Serializable {
private @Valid String name; private @Valid String name;

View File

@ -19,7 +19,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName("AdditionalPropertiesArray") @JsonTypeName("AdditionalPropertiesArray")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public class AdditionalPropertiesArray extends HashMap<String, List> implements Serializable { @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")
public class AdditionalPropertiesArray extends HashMap<String, List> implements Serializable {
private @Valid String name; private @Valid String name;

Some files were not shown because too many files have changed in this diff Show More