mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 01:56:09 +00:00
[Java][Server] fix default value (#8577)
* [Java][Server] fix default value * [Java][Server] fix default value
This commit is contained in:
@@ -176,9 +176,9 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) })
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<String>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray
|
||||
,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString
|
||||
,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("enum_query_string_array") List<String> enumQueryStringArray
|
||||
,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List<String> enumQueryStringArray
|
||||
,@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
|
||||
@@ -237,11 +237,11 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiOperation(value = "", notes = "To test the collection format in query parameters", response = Void.class, tags={ "fake", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) })
|
||||
public Response testQueryParameterCollectionFormat(@ApiParam(value = "",required=true, defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("pipe") List<String> pipe
|
||||
,@ApiParam(value = "",required=true, defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("ioutil") List<String> ioutil
|
||||
,@ApiParam(value = "",required=true, defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("http") List<String> http
|
||||
,@ApiParam(value = "",required=true, defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("url") List<String> url
|
||||
,@ApiParam(value = "",required=true, defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("context") List<String> context
|
||||
public Response testQueryParameterCollectionFormat(@ApiParam(value = "",required=true) @QueryParam("pipe") List<String> pipe
|
||||
,@ApiParam(value = "",required=true) @QueryParam("ioutil") List<String> ioutil
|
||||
,@ApiParam(value = "",required=true) @QueryParam("http") List<String> http
|
||||
,@ApiParam(value = "",required=true) @QueryParam("url") List<String> url
|
||||
,@ApiParam(value = "",required=true) @QueryParam("context") List<String> context
|
||||
)
|
||||
throws NotFoundException {
|
||||
return delegate.testQueryParameterCollectionFormat(pipe,ioutil,http,url,context);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
|
||||
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList<String>()") @DefaultValue("new ArrayList<String>()") @QueryParam("status") List<String> status
|
||||
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List<String> status
|
||||
)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByStatus(status);
|
||||
@@ -105,7 +105,7 @@ public class PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"),
|
||||
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "Set") })
|
||||
public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new LinkedHashSet<String>()") @DefaultValue("new LinkedHashSet<String>()") @QueryParam("tags") Set<String> tags
|
||||
public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") Set<String> tags
|
||||
)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByTags(tags);
|
||||
|
||||
@@ -89,7 +89,6 @@ public interface PathHandlerInterface {
|
||||
* <p>
|
||||
* - Parameter type: <b>{@link java.util.List List} of {@link List<String>}</b><br/>
|
||||
* - Appears in: <b>{@link HttpServerExchange#getQueryParameters Query}</b><br/>
|
||||
* - Default value: <b>new ArrayList<String>()</b><br/>
|
||||
* - Required: <b>true</b>
|
||||
* </p>
|
||||
* </li>
|
||||
@@ -122,7 +121,6 @@ public interface PathHandlerInterface {
|
||||
* <p>
|
||||
* - Parameter type: <b>{@link java.util.List List} of {@link List<String>}</b><br/>
|
||||
* - Appears in: <b>{@link HttpServerExchange#getQueryParameters Query}</b><br/>
|
||||
* - Default value: <b>new ArrayList<String>()</b><br/>
|
||||
* - Required: <b>true</b>
|
||||
* </p>
|
||||
* </li>
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,10 @@
|
||||
pom.xml
|
||||
src/gen/java/org/openapitools/api/TestHeadersApi.java
|
||||
src/gen/java/org/openapitools/api/TestHeadersApiService.java
|
||||
src/gen/java/org/openapitools/api/TestQueryParamsApi.java
|
||||
src/gen/java/org/openapitools/api/TestQueryParamsApiService.java
|
||||
src/gen/java/org/openapitools/model/TestResponse.java
|
||||
src/main/java/org/openapitools/api/RestApplication.java
|
||||
src/main/java/org/openapitools/api/impl/TestHeadersApiServiceImpl.java
|
||||
src/main/java/org/openapitools/api/impl/TestQueryParamsApiServiceImpl.java
|
||||
src/main/webapp/WEB-INF/beans.xml
|
||||
@@ -0,0 +1 @@
|
||||
5.1.0-SNAPSHOT
|
||||
97
samples/server/petstore/jaxrs-cxf-cdi-default-value/pom.xml
Normal file
97
samples/server/petstore/jaxrs-cxf-cdi-default-value/pom.xml
Normal file
@@ -0,0 +1,97 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jaxrs-cxf-cdi-default-value</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>jaxrs-cxf-cdi-default-value</name>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<build>
|
||||
<!-- Main source directory -->
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<!-- Add src/gen/java to compilation -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/gen/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Java EE 7 doesn't need a web.xml -->
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-frontend-jaxrs -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||
<!-- Version is just a guess -->
|
||||
<!-- Require at lease CXF 3.1.2 since HTTP PATCH support was added on this version -->
|
||||
<version>3.1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>[2.8.3,2.12.1]</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger annotations -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>[1.5.3,1.5.16]</version>
|
||||
</dependency>
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.1.0.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
import org.openapitools.api.TestHeadersApiService;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.PATCH;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
@Path("/test-headers")
|
||||
@RequestScoped
|
||||
|
||||
@Api(description = "the test-headers API")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen")
|
||||
|
||||
public class TestHeadersApi {
|
||||
|
||||
@Context SecurityContext securityContext;
|
||||
|
||||
@Inject TestHeadersApiService delegate;
|
||||
|
||||
|
||||
@GET
|
||||
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "test headers", notes = "desc", response = TestResponse.class, tags={ "verify-default-value" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "default response", response = TestResponse.class) })
|
||||
public Response headersTest( @ApiParam(value = "" , defaultValue="11.2")@HeaderParam("headerNumber") BigDecimal headerNumber, @ApiParam(value = "" , defaultValue="qwerty")@HeaderParam("headerString") String headerString, @ApiParam(value = "" , defaultValue="qwerty")@HeaderParam("headerStringWrapped") String headerStringWrapped, @ApiParam(value = "" , defaultValue="qwerty\"with quotes\" test")@HeaderParam("headerStringQuotes") String headerStringQuotes, @ApiParam(value = "" , defaultValue="qwerty\"with quotes\" test")@HeaderParam("headerStringQuotesWrapped") String headerStringQuotesWrapped, @ApiParam(value = "" , defaultValue="true")@HeaderParam("headerBoolean") Boolean headerBoolean) {
|
||||
return delegate.headersTest(headerNumber, headerString, headerStringWrapped, headerStringQuotes, headerStringQuotesWrapped, headerBoolean, securityContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen")
|
||||
public interface TestHeadersApiService {
|
||||
public Response headersTest(BigDecimal headerNumber, String headerString, String headerStringWrapped, String headerStringQuotes, String headerStringQuotesWrapped, Boolean headerBoolean, SecurityContext securityContext);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
import org.openapitools.api.TestQueryParamsApiService;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.PATCH;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
@Path("/test-query-params")
|
||||
@RequestScoped
|
||||
|
||||
@Api(description = "the test-query-params API")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen")
|
||||
|
||||
public class TestQueryParamsApi {
|
||||
|
||||
@Context SecurityContext securityContext;
|
||||
|
||||
@Inject TestQueryParamsApiService delegate;
|
||||
|
||||
|
||||
@GET
|
||||
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "test query params", notes = "desc", response = TestResponse.class, tags={ "verify-default-value" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "default response", response = TestResponse.class) })
|
||||
public Response queryParamsTest(@ApiParam(value = "", defaultValue="11.2") @DefaultValue("11.2") @QueryParam("queryNumber") BigDecimal queryNumber, @ApiParam(value = "", defaultValue="qwerty") @DefaultValue("qwerty") @QueryParam("queryString") String queryString, @ApiParam(value = "", defaultValue="qwerty") @DefaultValue("qwerty") @QueryParam("queryStringWrapped") String queryStringWrapped, @ApiParam(value = "", defaultValue="qwerty\"with quotes\" test") @DefaultValue("qwerty\"with quotes\" test") @QueryParam("queryStringQuotes") String queryStringQuotes, @ApiParam(value = "", defaultValue="qwerty\"with quotes\" test") @DefaultValue("qwerty\"with quotes\" test") @QueryParam("queryStringQuotesWrapped") String queryStringQuotesWrapped, @ApiParam(value = "", defaultValue="true") @DefaultValue("true") @QueryParam("queryBoolean") Boolean queryBoolean) {
|
||||
return delegate.queryParamsTest(queryNumber, queryString, queryStringWrapped, queryStringQuotes, queryStringQuotesWrapped, queryBoolean, securityContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen")
|
||||
public interface TestQueryParamsApiService {
|
||||
public Response queryParamsTest(BigDecimal queryNumber, String queryString, String queryStringWrapped, String queryStringQuotes, String queryStringQuotesWrapped, Boolean queryBoolean, SecurityContext securityContext);
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package org.openapitools.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
|
||||
|
||||
public class TestResponse {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String stringField = "asd";
|
||||
|
||||
private BigDecimal numberField = new BigDecimal("11");
|
||||
|
||||
private Boolean booleanField = true;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public TestResponse id(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("id")
|
||||
@NotNull
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public TestResponse stringField(String stringField) {
|
||||
this.stringField = stringField;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("stringField")
|
||||
@NotNull
|
||||
public String getStringField() {
|
||||
return stringField;
|
||||
}
|
||||
public void setStringField(String stringField) {
|
||||
this.stringField = stringField;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public TestResponse numberField(BigDecimal numberField) {
|
||||
this.numberField = numberField;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("numberField")
|
||||
@NotNull
|
||||
public BigDecimal getNumberField() {
|
||||
return numberField;
|
||||
}
|
||||
public void setNumberField(BigDecimal numberField) {
|
||||
this.numberField = numberField;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public TestResponse booleanField(Boolean booleanField) {
|
||||
this.booleanField = booleanField;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("booleanField")
|
||||
@NotNull
|
||||
public Boolean getBooleanField() {
|
||||
return booleanField;
|
||||
}
|
||||
public void setBooleanField(Boolean booleanField) {
|
||||
this.booleanField = booleanField;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestResponse testResponse = (TestResponse) o;
|
||||
return Objects.equals(id, testResponse.id) &&
|
||||
Objects.equals(stringField, testResponse.stringField) &&
|
||||
Objects.equals(numberField, testResponse.numberField) &&
|
||||
Objects.equals(booleanField, testResponse.booleanField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, stringField, numberField, booleanField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestResponse {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" stringField: ").append(toIndentedString(stringField)).append("\n");
|
||||
sb.append(" numberField: ").append(toIndentedString(numberField)).append("\n");
|
||||
sb.append(" booleanField: ").append(toIndentedString(booleanField)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
@ApplicationPath("")
|
||||
public class RestApplication extends Application {
|
||||
// Add implementation-specific details here
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.openapitools.api.impl;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen")
|
||||
public class TestHeadersApiServiceImpl implements TestHeadersApiService {
|
||||
@Override
|
||||
public Response headersTest(BigDecimal headerNumber, String headerString, String headerStringWrapped, String headerStringQuotes, String headerStringQuotesWrapped, Boolean headerBoolean, SecurityContext securityContext) {
|
||||
// do some magic!
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.openapitools.api.impl;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen")
|
||||
public class TestQueryParamsApiServiceImpl implements TestQueryParamsApiService {
|
||||
@Override
|
||||
public Response queryParamsTest(BigDecimal queryNumber, String queryString, String queryStringWrapped, String queryStringQuotes, String queryStringQuotesWrapped, Boolean queryBoolean, SecurityContext securityContext) {
|
||||
// do some magic!
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
|
||||
|
||||
<!--
|
||||
This is just an empty file so that CDI archive scanning kicks in when
|
||||
implicit archive scanning is disabled (such as on IBM Bluemix)
|
||||
-->
|
||||
|
||||
</beans>
|
||||
@@ -186,7 +186,7 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class)
|
||||
})
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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)
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class)
|
||||
})
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<String>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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)
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,21 @@
|
||||
README.md
|
||||
build.gradle
|
||||
pom.xml
|
||||
settings.gradle
|
||||
src/gen/java/org/openapitools/api/ApiException.java
|
||||
src/gen/java/org/openapitools/api/ApiOriginFilter.java
|
||||
src/gen/java/org/openapitools/api/ApiResponseMessage.java
|
||||
src/gen/java/org/openapitools/api/JacksonConfig.java
|
||||
src/gen/java/org/openapitools/api/NotFoundException.java
|
||||
src/gen/java/org/openapitools/api/RFC3339DateFormat.java
|
||||
src/gen/java/org/openapitools/api/RestApplication.java
|
||||
src/gen/java/org/openapitools/api/StringUtil.java
|
||||
src/gen/java/org/openapitools/api/TestHeadersApi.java
|
||||
src/gen/java/org/openapitools/api/TestHeadersApiService.java
|
||||
src/gen/java/org/openapitools/api/TestQueryParamsApi.java
|
||||
src/gen/java/org/openapitools/api/TestQueryParamsApiService.java
|
||||
src/gen/java/org/openapitools/model/TestResponse.java
|
||||
src/main/java/org/openapitools/api/impl/TestHeadersApiServiceImpl.java
|
||||
src/main/java/org/openapitools/api/impl/TestQueryParamsApiServiceImpl.java
|
||||
src/main/webapp/WEB-INF/jboss-web.xml
|
||||
src/main/webapp/WEB-INF/web.xml
|
||||
@@ -0,0 +1 @@
|
||||
5.1.0-SNAPSHOT
|
||||
@@ -0,0 +1,24 @@
|
||||
# JAX-RS/RESTEasy server with OpenAPI
|
||||
|
||||
## Overview
|
||||
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an
|
||||
[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub.
|
||||
|
||||
This is an example of building a OpenAPI-enabled JAX-RS server.
|
||||
This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework.
|
||||
RESTEasy is used as JAX-RS implementation library and is defined as dependency.
|
||||
|
||||
To run the server, please execute the following:
|
||||
|
||||
```
|
||||
mvn -Djetty.http.port=8080 package org.eclipse.jetty:jetty-maven-plugin:run
|
||||
```
|
||||
|
||||
You can then view the OpenAPI v2 specification here:
|
||||
|
||||
```
|
||||
http://localhost:8080/swagger.json
|
||||
```
|
||||
|
||||
Note that if you have configured the `host` to be something other than localhost, the calls through
|
||||
swagger-ui will be directed to that host and not localhost!
|
||||
@@ -0,0 +1,36 @@
|
||||
apply plugin: 'war'
|
||||
|
||||
project.version = "1.0.0"
|
||||
project.group = "org.openapitools"
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
providedCompile 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final'
|
||||
providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final'
|
||||
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final'
|
||||
providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final'
|
||||
providedCompile 'javax.annotation:javax.annotation-api:1.2'
|
||||
providedCompile 'javax:javaee-api:7.0'
|
||||
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
|
||||
compile 'io.swagger:swagger-annotations:1.5.22'
|
||||
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
|
||||
providedCompile 'javax.validation:validation-api:1.1.0.Final'
|
||||
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.9.9'
|
||||
compile 'joda-time:joda-time:2.7'
|
||||
//TODO: swaggerFeature
|
||||
compile 'io.swagger:swagger-jaxrs:1.5.12'
|
||||
|
||||
testCompile 'junit:junit:4.13',
|
||||
'org.hamcrest:hamcrest-core:1.3'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/gen/java'
|
||||
}
|
||||
}
|
||||
}
|
||||
196
samples/server/petstore/jaxrs-resteasy/default-value/pom.xml
Normal file
196
samples/server/petstore/jaxrs-resteasy/default-value/pom.xml
Normal file
@@ -0,0 +1,196 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jaxrs-resteasy-default-value</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>jaxrs-resteasy-default-value</name>
|
||||
<version>1.0.0</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>
|
||||
src/gen/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>${servlet-api-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<version>${resteasy-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>jaxrs-api</artifactId>
|
||||
<version>3.0.12.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-validator-provider-11</artifactId>
|
||||
<version>3.6.3.SP1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-multipart-provider</artifactId>
|
||||
<version>${resteasy-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||
<version>${resteasy-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>2.11.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-jaxrs</artifactId>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>6.8.8</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>junit</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<groupId>org.yaml</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bsh</artifactId>
|
||||
<groupId>org.beanshell</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.1.0.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<swagger-core-version>1.5.22</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<resteasy-version>3.13.0.Final</resteasy-version>
|
||||
<slf4j-version>1.6.3</slf4j-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<servlet-api-version>2.5</servlet-api-version>
|
||||
</properties>
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = "jaxrs-resteasy-default-value"
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
/**
|
||||
* The exception that can be used to store the HTTP status code returned by an API response.
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class ApiException extends Exception {
|
||||
|
||||
/** The HTTP status code. */
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param code The HTTP status code.
|
||||
* @param msg The error message.
|
||||
*/
|
||||
public ApiException(int code, String msg) {
|
||||
super(msg);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP status code.
|
||||
*
|
||||
* @return The HTTP status code.
|
||||
*/
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
res.addHeader("Access-Control-Allow-Origin", "*");
|
||||
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
|
||||
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
public void destroy() {}
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@javax.xml.bind.annotation.XmlRootElement
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class ApiResponseMessage {
|
||||
public static final int ERROR = 1;
|
||||
public static final int WARNING = 2;
|
||||
public static final int INFO = 3;
|
||||
public static final int OK = 4;
|
||||
public static final int TOO_BUSY = 5;
|
||||
|
||||
int code;
|
||||
String type;
|
||||
String message;
|
||||
|
||||
public ApiResponseMessage(){}
|
||||
|
||||
public ApiResponseMessage(int code, String message){
|
||||
this.code = code;
|
||||
switch(code){
|
||||
case ERROR:
|
||||
setType("error");
|
||||
break;
|
||||
case WARNING:
|
||||
setType("warning");
|
||||
break;
|
||||
case INFO:
|
||||
setType("info");
|
||||
break;
|
||||
case OK:
|
||||
setType("ok");
|
||||
break;
|
||||
case TOO_BUSY:
|
||||
setType("too busy");
|
||||
break;
|
||||
default:
|
||||
setType("unknown");
|
||||
break;
|
||||
}
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerationException;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.format.ISODateTimeFormat;
|
||||
|
||||
import javax.ws.rs.ext.ContextResolver;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
import java.io.IOException;
|
||||
|
||||
@Provider
|
||||
public class JacksonConfig implements ContextResolver<ObjectMapper> {
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public JacksonConfig() throws Exception {
|
||||
|
||||
objectMapper = new ObjectMapper()
|
||||
.setDateFormat(new RFC3339DateFormat())
|
||||
.registerModule(new JodaModule() {
|
||||
{
|
||||
addSerializer(DateTime.class, new StdSerializer<DateTime>(DateTime.class) {
|
||||
@Override
|
||||
public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
|
||||
jgen.writeString(ISODateTimeFormat.dateTimeNoMillis().print(value));
|
||||
}
|
||||
});
|
||||
addSerializer(LocalDate.class, new StdSerializer<LocalDate>(LocalDate.class) {
|
||||
@Override
|
||||
public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
|
||||
jgen.writeString(ISODateTimeFormat.date().print(value));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ObjectMapper getContext(Class<?> arg0) {
|
||||
return objectMapper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class NotFoundException extends ApiException {
|
||||
private int code;
|
||||
public NotFoundException (int code, String msg) {
|
||||
super(code, msg);
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.ParsePosition;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class RFC3339DateFormat extends DateFormat {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||
|
||||
private final StdDateFormat fmt = new StdDateFormat()
|
||||
.withTimeZone(TIMEZONE_Z)
|
||||
.withColonInTimeZone(true);
|
||||
|
||||
public RFC3339DateFormat() {
|
||||
this.calendar = new GregorianCalendar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date parse(String source, ParsePosition pos) {
|
||||
return fmt.parse(source, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
|
||||
return fmt.format(date, toAppendTo, fieldPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
@ApplicationPath("")
|
||||
public class RestApplication extends Application {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
*
|
||||
* @param array The array
|
||||
* @param value The value to search
|
||||
* @return true if the array contains the value
|
||||
*/
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) return true;
|
||||
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join an array of strings with the given separator.
|
||||
* <p>
|
||||
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||
* if one of those libraries is added as dependency.
|
||||
* </p>
|
||||
*
|
||||
* @param array The array of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.openapitools.model.*;
|
||||
import org.openapitools.api.TestHeadersApiService;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.jaxrs.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import org.openapitools.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Path("/test-headers")
|
||||
|
||||
|
||||
@io.swagger.annotations.Api(description = "the test-headers API")
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class TestHeadersApi {
|
||||
|
||||
@Inject TestHeadersApiService service;
|
||||
|
||||
@GET
|
||||
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "test headers", notes = "desc", response = TestResponse.class, tags={ "verify-default-value", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "default response", response = TestResponse.class) })
|
||||
public Response headersTest( @ApiParam(value = "" , defaultValue="11.2") @HeaderParam("headerNumber") BigDecimal headerNumber, @ApiParam(value = "" , defaultValue="qwerty") @HeaderParam("headerString") String headerString, @ApiParam(value = "" , defaultValue="qwerty") @HeaderParam("headerStringWrapped") String headerStringWrapped, @ApiParam(value = "" , defaultValue="qwerty\"with quotes\" test") @HeaderParam("headerStringQuotes") String headerStringQuotes, @ApiParam(value = "" , defaultValue="qwerty\"with quotes\" test") @HeaderParam("headerStringQuotesWrapped") String headerStringQuotesWrapped, @ApiParam(value = "" , defaultValue="true") @HeaderParam("headerBoolean") Boolean headerBoolean,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return service.headersTest(headerNumber,headerString,headerStringWrapped,headerStringQuotes,headerStringQuotesWrapped,headerBoolean,securityContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
import org.openapitools.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public interface TestHeadersApiService {
|
||||
Response headersTest(BigDecimal headerNumber,String headerString,String headerStringWrapped,String headerStringQuotes,String headerStringQuotesWrapped,Boolean headerBoolean,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.openapitools.model.*;
|
||||
import org.openapitools.api.TestQueryParamsApiService;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.jaxrs.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import org.openapitools.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Path("/test-query-params")
|
||||
|
||||
|
||||
@io.swagger.annotations.Api(description = "the test-query-params API")
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class TestQueryParamsApi {
|
||||
|
||||
@Inject TestQueryParamsApiService service;
|
||||
|
||||
@GET
|
||||
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@io.swagger.annotations.ApiOperation(value = "test query params", notes = "desc", response = TestResponse.class, tags={ "verify-default-value", })
|
||||
@io.swagger.annotations.ApiResponses(value = {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "default response", response = TestResponse.class) })
|
||||
public Response queryParamsTest( @DefaultValue("11.2") @QueryParam("queryNumber") BigDecimal queryNumber, @DefaultValue("qwerty") @QueryParam("queryString") String queryString, @DefaultValue("qwerty") @QueryParam("queryStringWrapped") String queryStringWrapped, @DefaultValue("qwerty\"with quotes\" test") @QueryParam("queryStringQuotes") String queryStringQuotes, @DefaultValue("qwerty\"with quotes\" test") @QueryParam("queryStringQuotesWrapped") String queryStringQuotesWrapped, @DefaultValue("true") @QueryParam("queryBoolean") Boolean queryBoolean,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return service.queryParamsTest(queryNumber,queryString,queryStringWrapped,queryStringQuotes,queryStringQuotesWrapped,queryBoolean,securityContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
import org.openapitools.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public interface TestQueryParamsApiService {
|
||||
Response queryParamsTest(BigDecimal queryNumber,String queryString,String queryStringWrapped,String queryStringQuotes,String queryStringQuotesWrapped,Boolean queryBoolean,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package org.openapitools.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.ArrayList;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.constraints.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class TestResponse {
|
||||
|
||||
private Integer id;
|
||||
private String stringField = "asd";
|
||||
private BigDecimal numberField = new BigDecimal("11");
|
||||
private Boolean booleanField = true;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("id")
|
||||
@NotNull
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("stringField")
|
||||
@NotNull
|
||||
public String getStringField() {
|
||||
return stringField;
|
||||
}
|
||||
public void setStringField(String stringField) {
|
||||
this.stringField = stringField;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("numberField")
|
||||
@NotNull
|
||||
public BigDecimal getNumberField() {
|
||||
return numberField;
|
||||
}
|
||||
public void setNumberField(BigDecimal numberField) {
|
||||
this.numberField = numberField;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@JsonProperty("booleanField")
|
||||
@NotNull
|
||||
public Boolean getBooleanField() {
|
||||
return booleanField;
|
||||
}
|
||||
public void setBooleanField(Boolean booleanField) {
|
||||
this.booleanField = booleanField;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestResponse testResponse = (TestResponse) o;
|
||||
return Objects.equals(id, testResponse.id) &&
|
||||
Objects.equals(stringField, testResponse.stringField) &&
|
||||
Objects.equals(numberField, testResponse.numberField) &&
|
||||
Objects.equals(booleanField, testResponse.booleanField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, stringField, numberField, booleanField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestResponse {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" stringField: ").append(toIndentedString(stringField)).append("\n");
|
||||
sb.append(" numberField: ").append(toIndentedString(numberField)).append("\n");
|
||||
sb.append(" booleanField: ").append(toIndentedString(booleanField)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.openapitools.api.impl;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
import org.openapitools.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class TestHeadersApiServiceImpl implements TestHeadersApiService {
|
||||
public Response headersTest(BigDecimal headerNumber,String headerString,String headerStringWrapped,String headerStringQuotes,String headerStringQuotesWrapped,Boolean headerBoolean,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.openapitools.api.impl;
|
||||
|
||||
import org.openapitools.api.*;
|
||||
import org.openapitools.model.*;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
|
||||
import java.util.List;
|
||||
import org.openapitools.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen")
|
||||
public class TestQueryParamsApiServiceImpl implements TestQueryParamsApiService {
|
||||
public Response queryParamsTest(BigDecimal queryNumber,String queryString,String queryStringWrapped,String queryStringQuotes,String queryStringQuotesWrapped,Boolean queryBoolean,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<jboss-web>
|
||||
<context-root></context-root>
|
||||
</jboss-web>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
|
||||
<filter>
|
||||
<filter-name>ApiOriginFilter</filter-name>
|
||||
<filter-class>org.openapitools.api.ApiOriginFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>ApiOriginFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
</web-app>
|
||||
@@ -108,7 +108,7 @@ import javax.validation.Valid;
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@ApiResponse(code = 404, message = "Not found", response = Void.class) })
|
||||
void testEnumParameters(@HeaderParam("enum_header_string_array") @DefaultValue("new ArrayList<String>()") @ApiParam("Header parameter enum test (string array)") List<String> enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString);
|
||||
void testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List<String> enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString);
|
||||
|
||||
@DELETE
|
||||
@ApiOperation(value = "Fake endpoint to test group parameters (optional)", notes = "Fake endpoint to test group parameters (optional)", tags={ "fake" })
|
||||
|
||||
@@ -136,7 +136,7 @@ import javax.validation.Valid;
|
||||
@ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@ApiResponse(code = 404, message = "Not found", response = Void.class)
|
||||
})
|
||||
public Response testEnumParameters(@HeaderParam("enum_header_string_array") @DefaultValue("new ArrayList<String>()") @ApiParam("Header parameter enum test (string array)") List<String> enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) {
|
||||
public Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List<String> enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) })
|
||||
public Response testEnumParameters(
|
||||
@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<String>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,
|
||||
@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,
|
||||
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,
|
||||
@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,
|
||||
@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,
|
||||
|
||||
@@ -185,7 +185,7 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) })
|
||||
public Response testEnumParameters(
|
||||
@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<String>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,
|
||||
@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,
|
||||
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,
|
||||
@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,
|
||||
@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,
|
||||
|
||||
@@ -184,7 +184,7 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class)
|
||||
})
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<String>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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)
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public class FakeApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class),
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class)
|
||||
})
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<String>()")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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)
|
||||
public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List<String> enumQueryStringArray,@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=">, $", 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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,13 @@
|
||||
README.md
|
||||
pom.xml
|
||||
src/main/java/org/openapitools/OpenAPI2SpringBoot.java
|
||||
src/main/java/org/openapitools/RFC3339DateFormat.java
|
||||
src/main/java/org/openapitools/api/ApiUtil.java
|
||||
src/main/java/org/openapitools/api/TestHeadersApi.java
|
||||
src/main/java/org/openapitools/api/TestHeadersApiController.java
|
||||
src/main/java/org/openapitools/api/TestQueryParamsApi.java
|
||||
src/main/java/org/openapitools/api/TestQueryParamsApiController.java
|
||||
src/main/java/org/openapitools/configuration/HomeController.java
|
||||
src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java
|
||||
src/main/java/org/openapitools/model/TestResponse.java
|
||||
src/main/resources/application.properties
|
||||
@@ -0,0 +1 @@
|
||||
5.1.0-SNAPSHOT
|
||||
18
samples/server/petstore/spring-mvc-default-value/README.md
Normal file
18
samples/server/petstore/spring-mvc-default-value/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# OpenAPI generated server
|
||||
|
||||
Spring Boot Server
|
||||
|
||||
|
||||
## Overview
|
||||
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
|
||||
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub.
|
||||
This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework.
|
||||
|
||||
The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox)
|
||||
|
||||
Start your server as a simple java application
|
||||
|
||||
You can view the api documentation in swagger-ui by pointing to
|
||||
http://localhost:8080/
|
||||
|
||||
Change default port value in application.properties
|
||||
79
samples/server/petstore/spring-mvc-default-value/pom.xml
Normal file
79
samples/server/petstore/spring-mvc-default-value/pom.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>spring-mvc-default-value</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>spring-mvc-default-value</name>
|
||||
<version>1.0.0</version>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<springfox-version>2.9.2</springfox-version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.3.RELEASE</version>
|
||||
</parent>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-commons</artifactId>
|
||||
</dependency>
|
||||
<!--SpringFox dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${springfox-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${springfox-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.openapitools;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.ExitCodeGenerator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"})
|
||||
public class OpenAPI2SpringBoot implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... arg0) throws Exception {
|
||||
if (arg0.length > 0 && arg0[0].equals("exitcode")) {
|
||||
throw new ExitException();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||
}
|
||||
|
||||
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public int getExitCode() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer webConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
/*@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("*")
|
||||
.allowedMethods("*")
|
||||
.allowedHeaders("Content-Type");
|
||||
}*/
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Module jsonNullableModule() {
|
||||
return new JsonNullableModule();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.openapitools;
|
||||
|
||||
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.ParsePosition;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public class RFC3339DateFormat extends DateFormat {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||
|
||||
private final StdDateFormat fmt = new StdDateFormat()
|
||||
.withTimeZone(TIMEZONE_Z)
|
||||
.withColonInTimeZone(true);
|
||||
|
||||
public RFC3339DateFormat() {
|
||||
this.calendar = new GregorianCalendar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date parse(String source, ParsePosition pos) {
|
||||
return fmt.parse(source, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
|
||||
return fmt.format(date, toAppendTo, fieldPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ApiUtil {
|
||||
public static void setExampleResponse(NativeWebRequest req, String contentType, String example) {
|
||||
try {
|
||||
HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class);
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
res.addHeader("Content-Type", contentType);
|
||||
res.getWriter().print(example);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.1.0-SNAPSHOT).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
@Validated
|
||||
@Api(value = "test-headers", description = "the test-headers API")
|
||||
public interface TestHeadersApi {
|
||||
|
||||
default Optional<NativeWebRequest> getRequest() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /test-headers : test headers
|
||||
* desc
|
||||
*
|
||||
* @param headerNumber (optional, default to 11.2)
|
||||
* @param headerString (optional, default to qwerty)
|
||||
* @param headerStringWrapped (optional, default to qwerty)
|
||||
* @param headerStringQuotes (optional, default to qwerty\"with quotes\" test)
|
||||
* @param headerStringQuotesWrapped (optional, default to qwerty\"with quotes\" test)
|
||||
* @param headerBoolean (optional, default to true)
|
||||
* @return default response (status code 200)
|
||||
*/
|
||||
@ApiOperation(value = "test headers", nickname = "headersTest", notes = "desc", response = TestResponse.class, tags={ "verify-default-value", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "default response", response = TestResponse.class) })
|
||||
@GetMapping(
|
||||
value = "/test-headers",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
default ResponseEntity<TestResponse> headersTest(@ApiParam(value = "" , defaultValue="11.2") @RequestHeader(value="headerNumber", required=false) BigDecimal headerNumber,@ApiParam(value = "" , defaultValue="qwerty") @RequestHeader(value="headerString", required=false) String headerString,@ApiParam(value = "" , defaultValue="qwerty") @RequestHeader(value="headerStringWrapped", required=false) String headerStringWrapped,@ApiParam(value = "" , defaultValue="qwerty\"with quotes\" test") @RequestHeader(value="headerStringQuotes", required=false) String headerStringQuotes,@ApiParam(value = "" , defaultValue="qwerty\"with quotes\" test") @RequestHeader(value="headerStringQuotesWrapped", required=false) String headerStringQuotesWrapped,@ApiParam(value = "" , defaultValue="true") @RequestHeader(value="headerBoolean", required=false) Boolean headerBoolean) {
|
||||
getRequest().ifPresent(request -> {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"numberField\" : 6.027456183070403, \"booleanField\" : true, \"id\" : 0, \"stringField\" : \"asd\" }";
|
||||
ApiUtil.setExampleResponse(request, "application/json", exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import java.util.Optional;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
@Controller
|
||||
@RequestMapping("${openapi.toto.base-path:}")
|
||||
public class TestHeadersApiController implements TestHeadersApi {
|
||||
|
||||
private final NativeWebRequest request;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
public TestHeadersApiController(NativeWebRequest request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<NativeWebRequest> getRequest() {
|
||||
return Optional.ofNullable(request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.1.0-SNAPSHOT).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
package org.openapitools.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.model.TestResponse;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
@Validated
|
||||
@Api(value = "test-query-params", description = "the test-query-params API")
|
||||
public interface TestQueryParamsApi {
|
||||
|
||||
default Optional<NativeWebRequest> getRequest() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /test-query-params : test query params
|
||||
* desc
|
||||
*
|
||||
* @param queryNumber (optional, default to 11.2)
|
||||
* @param queryString (optional, default to qwerty)
|
||||
* @param queryStringWrapped (optional, default to qwerty)
|
||||
* @param queryStringQuotes (optional, default to qwerty\"with quotes\" test)
|
||||
* @param queryStringQuotesWrapped (optional, default to qwerty\"with quotes\" test)
|
||||
* @param queryBoolean (optional, default to true)
|
||||
* @return default response (status code 200)
|
||||
*/
|
||||
@ApiOperation(value = "test query params", nickname = "queryParamsTest", notes = "desc", response = TestResponse.class, tags={ "verify-default-value", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "default response", response = TestResponse.class) })
|
||||
@GetMapping(
|
||||
value = "/test-query-params",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
default ResponseEntity<TestResponse> queryParamsTest(@ApiParam(value = "", defaultValue = "11.2") @Valid @RequestParam(value = "queryNumber", required = false, defaultValue="11.2") BigDecimal queryNumber,@ApiParam(value = "", defaultValue = "qwerty") @Valid @RequestParam(value = "queryString", required = false, defaultValue="qwerty") String queryString,@ApiParam(value = "", defaultValue = "qwerty") @Valid @RequestParam(value = "queryStringWrapped", required = false, defaultValue="qwerty") String queryStringWrapped,@ApiParam(value = "", defaultValue = "qwerty\"with quotes\" test") @Valid @RequestParam(value = "queryStringQuotes", required = false, defaultValue="qwerty\"with quotes\" test") String queryStringQuotes,@ApiParam(value = "", defaultValue = "qwerty\"with quotes\" test") @Valid @RequestParam(value = "queryStringQuotesWrapped", required = false, defaultValue="qwerty\"with quotes\" test") String queryStringQuotesWrapped,@ApiParam(value = "", defaultValue = "true") @Valid @RequestParam(value = "queryBoolean", required = false, defaultValue="true") Boolean queryBoolean) {
|
||||
getRequest().ifPresent(request -> {
|
||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"numberField\" : 6.027456183070403, \"booleanField\" : true, \"id\" : 0, \"stringField\" : \"asd\" }";
|
||||
ApiUtil.setExampleResponse(request, "application/json", exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.openapitools.api;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import java.util.Optional;
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
@Controller
|
||||
@RequestMapping("${openapi.toto.base-path:}")
|
||||
public class TestQueryParamsApiController implements TestQueryParamsApi {
|
||||
|
||||
private final NativeWebRequest request;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
public TestQueryParamsApiController(NativeWebRequest request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<NativeWebRequest> getRequest() {
|
||||
return Optional.ofNullable(request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.openapitools.configuration;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
|
||||
/**
|
||||
* Home redirection to OpenAPI api documentation
|
||||
*/
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
@RequestMapping("/")
|
||||
public String index() {
|
||||
return "redirect:swagger-ui.html";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.openapitools.configuration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.paths.Paths;
|
||||
import springfox.documentation.spring.web.paths.RelativePathProvider;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class OpenAPIDocumentationConfig {
|
||||
|
||||
ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("toto")
|
||||
.description("desc")
|
||||
.license("")
|
||||
.licenseUrl("http://unlicense.org")
|
||||
.termsOfServiceUrl("")
|
||||
.version("1.0.0")
|
||||
.contact(new Contact("","", ""))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket customImplementation(ServletContext servletContext, @Value("${openapi.toto.base-path:}") String basePath) {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("org.openapitools.api"))
|
||||
.build()
|
||||
.pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath))
|
||||
.directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
|
||||
.directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
|
||||
.apiInfo(apiInfo());
|
||||
}
|
||||
|
||||
class BasePathAwareRelativePathProvider extends RelativePathProvider {
|
||||
private String basePath;
|
||||
|
||||
public BasePathAwareRelativePathProvider(ServletContext servletContext, String basePath) {
|
||||
super(servletContext);
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String applicationPath() {
|
||||
return Paths.removeAdjacentForwardSlashes(UriComponentsBuilder.fromPath(super.applicationPath()).path(basePath).build().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOperationPath(String operationPath) {
|
||||
UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromPath("/");
|
||||
return Paths.removeAdjacentForwardSlashes(
|
||||
uriComponentsBuilder.path(operationPath.replaceFirst("^" + basePath, "")).build().toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package org.openapitools.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* TestResponse
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
|
||||
public class TestResponse {
|
||||
@JsonProperty("id")
|
||||
private Integer id;
|
||||
|
||||
@JsonProperty("stringField")
|
||||
private String stringField = "asd";
|
||||
|
||||
@JsonProperty("numberField")
|
||||
private BigDecimal numberField = new BigDecimal("11");
|
||||
|
||||
@JsonProperty("booleanField")
|
||||
private Boolean booleanField = true;
|
||||
|
||||
public TestResponse id(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
*/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@NotNull
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TestResponse stringField(String stringField) {
|
||||
this.stringField = stringField;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stringField
|
||||
* @return stringField
|
||||
*/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@NotNull
|
||||
|
||||
|
||||
public String getStringField() {
|
||||
return stringField;
|
||||
}
|
||||
|
||||
public void setStringField(String stringField) {
|
||||
this.stringField = stringField;
|
||||
}
|
||||
|
||||
public TestResponse numberField(BigDecimal numberField) {
|
||||
this.numberField = numberField;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get numberField
|
||||
* @return numberField
|
||||
*/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@NotNull
|
||||
|
||||
@Valid
|
||||
|
||||
public BigDecimal getNumberField() {
|
||||
return numberField;
|
||||
}
|
||||
|
||||
public void setNumberField(BigDecimal numberField) {
|
||||
this.numberField = numberField;
|
||||
}
|
||||
|
||||
public TestResponse booleanField(Boolean booleanField) {
|
||||
this.booleanField = booleanField;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get booleanField
|
||||
* @return booleanField
|
||||
*/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@NotNull
|
||||
|
||||
|
||||
public Boolean getBooleanField() {
|
||||
return booleanField;
|
||||
}
|
||||
|
||||
public void setBooleanField(Boolean booleanField) {
|
||||
this.booleanField = booleanField;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestResponse testResponse = (TestResponse) o;
|
||||
return Objects.equals(this.id, testResponse.id) &&
|
||||
Objects.equals(this.stringField, testResponse.stringField) &&
|
||||
Objects.equals(this.numberField, testResponse.numberField) &&
|
||||
Objects.equals(this.booleanField, testResponse.booleanField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, stringField, numberField, booleanField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestResponse {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" stringField: ").append(toIndentedString(stringField)).append("\n");
|
||||
sb.append(" numberField: ").append(toIndentedString(numberField)).append("\n");
|
||||
sb.append(" booleanField: ").append(toIndentedString(booleanField)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
springfox.documentation.swagger.v2.path=/api-docs
|
||||
server.port=8080
|
||||
spring.jackson.date-format=org.openapitools.RFC3339DateFormat
|
||||
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
|
||||
@@ -266,9 +266,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -208,9 +208,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -192,9 +192,9 @@ public class FakeApiController implements FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -230,9 +230,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -200,9 +200,9 @@ public interface FakeApiDelegate {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -230,9 +230,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -200,9 +200,9 @@ public interface FakeApiDelegate {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -279,7 +279,7 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -234,9 +234,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -227,9 +227,9 @@ public interface FakeApiDelegate {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -208,9 +208,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -167,9 +167,9 @@ public class FakeApiController implements FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -147,9 +147,9 @@ public interface FakeApiDelegate {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -230,9 +230,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -200,9 +200,9 @@ public interface FakeApiDelegate {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -208,9 +208,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -192,9 +192,9 @@ public class FakeApiController implements FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -273,9 +273,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
@@ -261,9 +261,9 @@ public interface FakeApi {
|
||||
* GET /fake : To test enum parameters
|
||||
* To test enum parameters
|
||||
*
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
|
||||
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>())
|
||||
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
|
||||
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||
|
||||
Reference in New Issue
Block a user