Skip to content

Commit

Permalink
[JaxRS] Add "validation-api" dependency in jetty (#30)
Browse files Browse the repository at this point in the history
Fix #28 

* Add "javax.validation:validation-api" dependency in jetty
* Update JaxRS and Spring samples
  • Loading branch information
jmini authored May 13, 2018
1 parent ab9c4b5 commit 4d7fc04
Show file tree
Hide file tree
Showing 54 changed files with 399 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
{{#useBeanValidation}}
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
{{/useBeanValidation}}
<executions>
<execution>
<id>start-jetty</id>
Expand Down Expand Up @@ -194,9 +203,9 @@
<junit-version>4.12</junit-version>
<logback-version>1.1.7</logback-version>
<servlet-api-version>2.5</servlet-api-version>
{{#useBeanValidation}}
{{#useBeanValidation}}
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
{{/useBeanValidation}}
{{/useBeanValidation}}
<cxf-version>3.2.1</cxf-version>
<jackson-jaxrs-version>2.9.1</jackson-jaxrs-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
{{#useBeanValidation}}
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
{{/useBeanValidation}}
<executions>
<execution>
<id>start-jetty</id>
Expand Down Expand Up @@ -245,9 +254,9 @@
<junit-version>4.12</junit-version>
<logback-version>1.1.7</logback-version>
<servlet-api-version>2.5</servlet-api-version>
{{#useBeanValidation}}
{{#useBeanValidation}}
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
{{/useBeanValidation}}
{{/useBeanValidation}}
{{#generateSpringApplication}}
<spring-version>4.3.13.RELEASE</spring-version>
{{/generateSpringApplication}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
{{#useBeanValidation}}
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
{{/useBeanValidation}}
<executions>
<execution>
<id>start-jetty</id>
Expand Down Expand Up @@ -173,10 +182,10 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
{{/useBeanValidation}}
</dependencies>
<repositories>
<repository>
Expand All @@ -192,6 +201,9 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-core-version>1.5.18</swagger-core-version>
{{#useBeanValidation}}
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
{{/useBeanValidation}}
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.19.1</jersey-version>
<jackson-version>2.8.9</jackson-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
{{#useBeanValidation}}
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
{{/useBeanValidation}}
<executions>
<execution>
<id>start-jetty</id>
Expand Down Expand Up @@ -178,7 +187,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
Expand All @@ -198,6 +207,9 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-core-version>1.5.18</swagger-core-version>
{{#useBeanValidation}}
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
{{/useBeanValidation}}
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey2-version>2.22.2</jersey2-version>
<jackson-version>2.8.9</jackson-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
{{#useBeanValidation}}
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
{{/useBeanValidation}}
<executions>
<execution>
<id>start-jetty</id>
Expand Down Expand Up @@ -156,10 +165,10 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>
{{/useBeanValidation}}
{{/useBeanValidation}}
</dependencies>
<properties>
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
Expand All @@ -172,6 +181,9 @@
<springfox-version>2.7.0</springfox-version>
<jackson-version>2.8.9</jackson-version>
<jackson-threetenbp-version>2.6.4</jackson-threetenbp-version>
{{#useBeanValidation}}
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
{{/useBeanValidation}}
<spring-version>4.3.9.RELEASE</spring-version>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<artifactId>cxf-annotated-basepath</artifactId>
<packaging>war</packaging>
<name>cxf-annotated-basepath</name>
<description>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.</description>
<description>This is a sample server Petstore server. For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.</description>
<version>1.0.0</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
Expand Down Expand Up @@ -37,6 +37,13 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>start-jetty</id>
Expand Down
9 changes: 8 additions & 1 deletion samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<artifactId>cxf-server-non-spring</artifactId>
<packaging>war</packaging>
<name>cxf-server-non-spring</name>
<description>This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.</description>
<description>This is a sample server Petstore server. For this sample, you can use the api key &#x60;special-key&#x60; to test the authorization filters.</description>
<version>1.0.0</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
Expand Down Expand Up @@ -37,6 +37,13 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>start-jetty</id>
Expand Down
7 changes: 7 additions & 0 deletions samples/server/petstore/jaxrs-cxf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>start-jetty</id>
Expand Down
23 changes: 23 additions & 0 deletions samples/server/petstore/jaxrs-datelib-j8/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
10 changes: 9 additions & 1 deletion samples/server/petstore/jaxrs-datelib-j8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${beanvalidation-version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>start-jetty</id>
Expand Down Expand Up @@ -155,7 +162,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<version>${beanvalidation-version}</version>
<scope>provided</scope>
</dependency>

Expand All @@ -174,6 +181,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-core-version>1.5.18</swagger-core-version>
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey2-version>2.22.2</jersey2-version>
<jackson-version>2.8.9</jackson-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public FakeApi(@Context ServletConfig servletContext) {
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) })
public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean booleanPostBody
public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body
,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.fakeOuterBooleanSerialize(booleanPostBody,securityContext);
return delegate.fakeOuterBooleanSerialize(body,securityContext);
}
@POST
@Path("/outer/composite")
Expand Down Expand Up @@ -145,22 +145,22 @@ public Response testClientModel(@ApiParam(value = "client model" ,required=true)
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),

@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number
,@ApiParam(value = "None", required=true) @FormParam("double") Double _double
,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter
,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte
,@ApiParam(value = "None", allowableValues="range=[10, 100]") @FormParam("integer") Integer integer
,@ApiParam(value = "None", allowableValues="range=[20, 200]") @FormParam("int32") Integer int32
,@ApiParam(value = "None") @FormParam("int64") Long int64
,@ApiParam(value = "None") @FormParam("float") Float _float
,@ApiParam(value = "None") @FormParam("string") String string
public Response testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number
,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double
,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter
,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string
,
@FormDataParam("binary") InputStream binaryInputStream,
@FormDataParam("binary") FormDataContentDisposition binaryDetail
,@ApiParam(value = "None") @FormParam("date") LocalDate date
,@ApiParam(value = "None") @FormParam("dateTime") OffsetDateTime dateTime
,@ApiParam(value = "None") @FormParam("password") String password
,@ApiParam(value = "None") @FormParam("callback") String paramCallback
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") LocalDate date
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") OffsetDateTime dateTime
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback
,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binaryInputStream, binaryDetail,date,dateTime,password,paramCallback,securityContext);
Expand All @@ -180,8 +180,8 @@ public Response testEnumParameters(@ApiParam(value = "Header parameter enum test
,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString
,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger
,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble
,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @FormParam("enum_form_string_array") List<String> enumFormStringArray
,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)") @FormParam("enum_form_string") String enumFormString
,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List<String> enumFormStringArray
,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString
,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.testEnumParameters(enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,enumFormStringArray,enumFormString,securityContext);
Expand All @@ -193,7 +193,7 @@ public Response testEnumParameters(@ApiParam(value = "Header parameter enum test
@io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) String requestBody
public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) Map<String, String> requestBody
,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.testInlineAdditionalProperties(requestBody,securityContext);
Expand All @@ -205,8 +205,8 @@ public Response testInlineAdditionalProperties(@ApiParam(value = "request body"
@io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param
,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2
public Response testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param
,@ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2
,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.testJsonFormData(param,param2,securityContext);
Expand Down
Loading

0 comments on commit 4d7fc04

Please sign in to comment.