From 3f81378d72af833e0dff37dbecda4d5e45b6135a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bresson?= Date: Wed, 23 May 2018 08:38:18 +0200 Subject: [PATCH] [java resteasy] fix string comparison (#134) * Fix StringUtils.isEmpty(..) * Update all JaxRS samples --- .../JavaResteasyEapServerCodegen.java | 19 ++++++++++--------- .../java/org/openapitools/model/Category.java | 2 ++ .../openapitools/model/ModelApiResponse.java | 3 +++ .../java/org/openapitools/model/Order.java | 6 ++++++ .../gen/java/org/openapitools/model/Pet.java | 6 ++++++ .../gen/java/org/openapitools/model/Tag.java | 2 ++ .../gen/java/org/openapitools/model/User.java | 8 ++++++++ .../java/org/openapitools/model/Category.java | 2 ++ .../openapitools/model/ModelApiResponse.java | 3 +++ .../java/org/openapitools/model/Order.java | 6 ++++++ .../gen/java/org/openapitools/model/Pet.java | 6 ++++++ .../gen/java/org/openapitools/model/Tag.java | 2 ++ .../gen/java/org/openapitools/model/User.java | 8 ++++++++ .../java/org/openapitools/model/Category.java | 2 ++ .../openapitools/model/ModelApiResponse.java | 3 +++ .../java/org/openapitools/model/Order.java | 6 ++++++ .../gen/java/org/openapitools/model/Pet.java | 6 ++++++ .../gen/java/org/openapitools/model/Tag.java | 2 ++ .../gen/java/org/openapitools/model/User.java | 8 ++++++++ 19 files changed, 91 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java index 1b7b766001..d4430f6de6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaResteasyEapServerCodegen.java @@ -17,20 +17,21 @@ package org.openapitools.codegen.languages; +import io.swagger.v3.oas.models.Operation; + +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.features.BeanValidationFeatures; +import org.openapitools.codegen.languages.features.JbossFeature; +import org.openapitools.codegen.languages.features.SwaggerFeatures; + import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.codegen.*; -import org.openapitools.codegen.languages.features.BeanValidationFeatures; -import org.openapitools.codegen.languages.features.JbossFeature; -import org.openapitools.codegen.languages.features.SwaggerFeatures; -import io.swagger.v3.oas.models.*; -import org.apache.commons.lang3.BooleanUtils; -import org.apache.commons.lang3.StringUtils; - public class JavaResteasyEapServerCodegen extends AbstractJavaJAXRSServerCodegen implements JbossFeature, BeanValidationFeatures, SwaggerFeatures { @@ -126,7 +127,7 @@ public class JavaResteasyEapServerCodegen extends AbstractJavaJAXRSServerCodegen basePath = basePath.substring(0, pos); } - if (StringUtils.isEmpty("")) { + if (StringUtils.isEmpty(basePath)) { basePath = "default"; } else { if (co.path.startsWith("/" + basePath)) { diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java index 8c46a6c2b4..35e9aacb1e 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java @@ -12,7 +12,9 @@ import io.swagger.annotations.*; public class Category { + private Long id = null; + private String name = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java index 660b5b9093..dd334211b1 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -12,8 +12,11 @@ import io.swagger.annotations.*; public class ModelApiResponse { + private Integer code = null; + private String type = null; + private String message = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java index 8518699c01..af93cbba61 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java @@ -14,9 +14,13 @@ import io.swagger.annotations.*; public class Order { + private Long id = null; + private Long petId = null; + private Integer quantity = null; + private OffsetDateTime shipDate = null; /** @@ -41,7 +45,9 @@ public class Order { } } + private StatusEnum status = null; + private Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java index b045a55b56..d7313d89b0 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java @@ -16,10 +16,15 @@ import io.swagger.annotations.*; public class Pet { + private Long id = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList<>(); + private List tags = new ArrayList<>(); /** @@ -44,6 +49,7 @@ public class Pet { } } + private StatusEnum status = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java index 94185c53ca..61c1a65126 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java @@ -12,7 +12,9 @@ import io.swagger.annotations.*; public class Tag { + private Long id = null; + private String name = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java index 7cab17060c..04e0f20908 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java @@ -12,13 +12,21 @@ import io.swagger.annotations.*; public class User { + private Long id = null; + private String username = null; + private String firstName = null; + private String lastName = null; + private String email = null; + private String password = null; + private String phone = null; + private Integer userStatus = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java index 8c46a6c2b4..35e9aacb1e 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java @@ -12,7 +12,9 @@ import io.swagger.annotations.*; public class Category { + private Long id = null; + private String name = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java index 660b5b9093..dd334211b1 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -12,8 +12,11 @@ import io.swagger.annotations.*; public class ModelApiResponse { + private Integer code = null; + private String type = null; + private String message = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java index e1cf859474..3c500ba035 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java @@ -14,9 +14,13 @@ import io.swagger.annotations.*; public class Order { + private Long id = null; + private Long petId = null; + private Integer quantity = null; + private DateTime shipDate = null; /** @@ -41,7 +45,9 @@ public class Order { } } + private StatusEnum status = null; + private Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java index 172f1bc51c..4260e1534f 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java @@ -16,10 +16,15 @@ import io.swagger.annotations.*; public class Pet { + private Long id = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); /** @@ -44,6 +49,7 @@ public class Pet { } } + private StatusEnum status = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java index 94185c53ca..61c1a65126 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java @@ -12,7 +12,9 @@ import io.swagger.annotations.*; public class Tag { + private Long id = null; + private String name = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java index 7cab17060c..04e0f20908 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java @@ -12,13 +12,21 @@ import io.swagger.annotations.*; public class User { + private Long id = null; + private String username = null; + private String firstName = null; + private String lastName = null; + private String email = null; + private String password = null; + private String phone = null; + private Integer userStatus = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java index 8c46a6c2b4..35e9aacb1e 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java @@ -12,7 +12,9 @@ import io.swagger.annotations.*; public class Category { + private Long id = null; + private String name = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java index 660b5b9093..dd334211b1 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -12,8 +12,11 @@ import io.swagger.annotations.*; public class ModelApiResponse { + private Integer code = null; + private String type = null; + private String message = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java index be82bfceae..6e99eac7a5 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java @@ -14,9 +14,13 @@ import io.swagger.annotations.*; public class Order { + private Long id = null; + private Long petId = null; + private Integer quantity = null; + private Date shipDate = null; /** @@ -41,7 +45,9 @@ public class Order { } } + private StatusEnum status = null; + private Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java index 172f1bc51c..4260e1534f 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java @@ -16,10 +16,15 @@ import io.swagger.annotations.*; public class Pet { + private Long id = null; + private Category category = null; + private String name = null; + private List photoUrls = new ArrayList(); + private List tags = new ArrayList(); /** @@ -44,6 +49,7 @@ public class Pet { } } + private StatusEnum status = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java index 94185c53ca..61c1a65126 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java @@ -12,7 +12,9 @@ import io.swagger.annotations.*; public class Tag { + private Long id = null; + private String name = null; /** diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java index 7cab17060c..04e0f20908 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java @@ -12,13 +12,21 @@ import io.swagger.annotations.*; public class User { + private Long id = null; + private String username = null; + private String firstName = null; + private String lastName = null; + private String email = null; + private String password = null; + private String phone = null; + private Integer userStatus = null; /**