From d054a43b658e3fee098c43e38eb432fe94fa5be1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 9 Oct 2017 23:00:44 +0800 Subject: [PATCH] update java server samples --- .../petstore/jaxrs-cxf-cdi/swagger.json | 6 +- .../java/io/swagger/api/AnotherFakeApi.java | 35 ++++++++ .../api/impl/AnotherFakeApiServiceImpl.java | 27 ++++++ .../io/swagger/api/AnotherFakeApiTest.java | 88 +++++++++++++++++++ .../petstore/jaxrs-resteasy/eap-joda/pom.xml | 9 ++ .../petstore/jaxrs-resteasy/eap/pom.xml | 9 ++ .../jaxrs-spec-interface/swagger.json | 18 ++-- .../server/petstore/jaxrs-spec/swagger.json | 18 ++-- .../java/io/swagger/api/AnotherFakeApi.java | 50 +++++++++++ .../io/swagger/api/AnotherFakeApiService.java | 25 ++++++ .../main/java/io/swagger/api/Bootstrap.java | 2 +- .../AnotherFakeApiServiceFactory.java | 13 +++ .../api/impl/AnotherFakeApiServiceImpl.java | 29 ++++++ .../java/io/swagger/api/AnotherFakeApi.java | 50 +++++++++++ .../io/swagger/api/AnotherFakeApiService.java | 25 ++++++ .../main/java/io/swagger/api/Bootstrap.java | 2 +- .../AnotherFakeApiServiceFactory.java | 13 +++ .../api/impl/AnotherFakeApiServiceImpl.java | 29 ++++++ .../java/io/swagger/api/AnotherFakeApi.java | 69 +++++++++++++++ .../io/swagger/api/AnotherFakeApiService.java | 21 +++++ .../main/java/io/swagger/api/Bootstrap.java | 2 +- .../AnotherFakeApiServiceFactory.java | 13 +++ .../api/impl/AnotherFakeApiServiceImpl.java | 25 ++++++ .../java/io/swagger/api/AnotherFakeApi.java | 69 +++++++++++++++ .../io/swagger/api/AnotherFakeApiService.java | 21 +++++ .../main/java/io/swagger/api/Bootstrap.java | 2 +- .../AnotherFakeApiServiceFactory.java | 13 +++ .../api/impl/AnotherFakeApiServiceImpl.java | 25 ++++++ .../java/io/swagger/api/AnotherFakeApi.java | 44 ++++++++++ .../swagger/api/AnotherFakeApiController.java | 17 ++++ .../SwaggerDocumentationConfig.java | 2 +- .../model/AdditionalPropertiesClass.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../io/swagger/model/ArrayOfNumberOnly.java | 2 +- .../main/java/io/swagger/model/ArrayTest.java | 6 +- .../java/io/swagger/model/EnumArrays.java | 2 +- .../main/java/io/swagger/model/MapTest.java | 4 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 4 +- .../java/io/swagger/api/AnotherFakeApi.java | 39 ++++++++ .../swagger/api/AnotherFakeApiController.java | 42 +++++++++ .../SwaggerDocumentationConfig.java | 2 +- .../java/io/swagger/api/AnotherFakeApi.java | 39 ++++++++ .../swagger/api/AnotherFakeApiController.java | 42 +++++++++ .../SwaggerDocumentationConfig.java | 2 +- .../java/io/swagger/api/AnotherFakeApi.java | 43 +++++++++ .../swagger/api/AnotherFakeApiController.java | 44 ++++++++++ .../swagger/api/AnotherFakeApiDelegate.java | 28 ++++++ .../SwaggerDocumentationConfig.java | 2 +- .../model/AdditionalPropertiesClass.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 2 +- .../io/swagger/model/ArrayOfNumberOnly.java | 2 +- .../main/java/io/swagger/model/ArrayTest.java | 6 +- .../java/io/swagger/model/EnumArrays.java | 2 +- .../main/java/io/swagger/model/MapTest.java | 4 +- ...ropertiesAndAdditionalPropertiesClass.java | 2 +- .../src/main/java/io/swagger/model/Pet.java | 4 +- .../java/io/swagger/api/AnotherFakeApi.java | 39 ++++++++ .../swagger/api/AnotherFakeApiController.java | 44 ++++++++++ .../swagger/api/AnotherFakeApiDelegate.java | 24 +++++ .../SwaggerDocumentationConfig.java | 2 +- .../java/io/swagger/api/AnotherFakeApi.java | 42 +++++++++ .../swagger/api/AnotherFakeApiController.java | 42 +++++++++ .../SwaggerDocumentationConfig.java | 2 +- .../java/io/swagger/api/AnotherFakeApi.java | 40 +++++++++ .../swagger/api/AnotherFakeApiController.java | 43 +++++++++ .../SwaggerDocumentationConfig.java | 2 +- .../java/io/swagger/api/AnotherFakeApi.java | 39 ++++++++ .../swagger/api/AnotherFakeApiController.java | 42 +++++++++ .../SwaggerDocumentationConfig.java | 2 +- 70 files changed, 1410 insertions(+), 59 deletions(-) create mode 100644 samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/AnotherFakeApiTest.java create mode 100644 samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java create mode 100644 samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java create mode 100644 samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApiController.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApiController.java diff --git a/samples/server/petstore/jaxrs-cxf-cdi/swagger.json b/samples/server/petstore/jaxrs-cxf-cdi/swagger.json index a16c8a8a14d..46239b84287 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/swagger.json +++ b/samples/server/petstore/jaxrs-cxf-cdi/swagger.json @@ -9,7 +9,7 @@ "email" : "apiteam@swagger.io" }, "license" : { - "name" : "Apache 2.0", + "name" : "Apache-2.0", "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" } }, @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..3accd4f023e --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,35 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Path("/") +@Api(value = "/", description = "") +public interface AnotherFakeApi { + + @PATCH + @Path("/another-fake/dummy") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test special tags", tags={ "$another-fake?" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Client testSpecialTags(@Valid Client body); +} + diff --git a/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..5de97453193 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,27 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.Client; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; + +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; + +public class AnotherFakeApiServiceImpl implements AnotherFakeApi { + public Client testSpecialTags(Client body) { + // TODO: Implement... + + return null; + } + +} + diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/AnotherFakeApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/AnotherFakeApiTest.java new file mode 100644 index 00000000000..85670e19231 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/AnotherFakeApiTest.java @@ -0,0 +1,88 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package io.swagger.api; + +import io.swagger.model.Client; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * API tests for AnotherFakeApi + */ +public class AnotherFakeApiTest { + + + private AnotherFakeApi api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", AnotherFakeApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * To test special tags + * + * To test special tags + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testSpecialTagsTest() { + Client body = null; + //Client response = api.testSpecialTags(body); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml b/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml index bb8a728d7e4..ca2b969d27c 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml @@ -9,6 +9,15 @@ src/main/java + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.7 + 1.7 + + org.apache.maven.plugins maven-war-plugin diff --git a/samples/server/petstore/jaxrs-resteasy/eap/pom.xml b/samples/server/petstore/jaxrs-resteasy/eap/pom.xml index 05d529c92e0..0fd778a0928 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/pom.xml +++ b/samples/server/petstore/jaxrs-resteasy/eap/pom.xml @@ -9,6 +9,15 @@ src/main/java + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.7 + 1.7 + + org.apache.maven.plugins maven-war-plugin diff --git a/samples/server/petstore/jaxrs-spec-interface/swagger.json b/samples/server/petstore/jaxrs-spec-interface/swagger.json index 7c2e6c0cc65..6812fe6e0e8 100644 --- a/samples/server/petstore/jaxrs-spec-interface/swagger.json +++ b/samples/server/petstore/jaxrs-spec-interface/swagger.json @@ -9,7 +9,7 @@ "email" : "apiteam@swagger.io" }, "license" : { - "name" : "Apache 2.0", + "name" : "Apache-2.0", "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" } }, @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], @@ -680,8 +680,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_form_string", @@ -699,8 +699,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_header_string", @@ -718,8 +718,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_query_string", diff --git a/samples/server/petstore/jaxrs-spec/swagger.json b/samples/server/petstore/jaxrs-spec/swagger.json index 7c2e6c0cc65..6812fe6e0e8 100644 --- a/samples/server/petstore/jaxrs-spec/swagger.json +++ b/samples/server/petstore/jaxrs-spec/swagger.json @@ -9,7 +9,7 @@ "email" : "apiteam@swagger.io" }, "license" : { - "name" : "Apache 2.0", + "name" : "Apache-2.0", "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" } }, @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], @@ -680,8 +680,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_form_string", @@ -699,8 +699,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_header_string", @@ -718,8 +718,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ ">", "$" ], - "default" : "$" + "default" : "$", + "enum" : [ ">", "$" ] } }, { "name" : "enum_query_string", diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..a1d379a5bc1 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,50 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.factories.AnotherFakeApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import com.sun.jersey.multipart.FormDataParam; +import javax.validation.constraints.*; + +import io.swagger.model.Client; + +import java.util.Map; +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/AnotherFake") + + +@io.swagger.annotations.Api(description = "the AnotherFake API") + +public class AnotherFakeApi { + private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi(); + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?" }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testSpecialTags( + @ApiParam(value = "client model" ,required=true) Client body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testSpecialTags(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java new file mode 100644 index 00000000000..eaec0e3e1ae --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java @@ -0,0 +1,25 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import com.sun.jersey.multipart.FormDataParam; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class AnotherFakeApiService { + public abstract Response testSpecialTags(Client body,SecurityContext securityContext) + throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/Bootstrap.java index 5e5532439b7..38a037ef487 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/Bootstrap.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/Bootstrap.java @@ -20,7 +20,7 @@ public void init(ServletConfig config) throws ServletException { .contact(new Contact() .email("apiteam@swagger.io")) .license(new License() - .name("Apache 2.0") + .name("Apache-2.0") .url("http://www.apache.org/licenses/LICENSE-2.0.html")); ServletContext context = config.getServletContext(); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java new file mode 100644 index 00000000000..d44d5c06204 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.impl.AnotherFakeApiServiceImpl; + + +public class AnotherFakeApiServiceFactory { + private final static AnotherFakeApiService service = new AnotherFakeApiServiceImpl(); + + public static AnotherFakeApiService getAnotherFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..072d33568d4 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,29 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import com.sun.jersey.multipart.FormDataParam; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { + @Override + public Response testSpecialTags(Client body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..e6e3cde0650 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,50 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.factories.AnotherFakeApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import com.sun.jersey.multipart.FormDataParam; +import javax.validation.constraints.*; + +import io.swagger.model.Client; + +import java.util.Map; +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/another-fake") + + +@io.swagger.annotations.Api(description = "the another-fake API") + +public class AnotherFakeApi { + private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi(); + + @PATCH + @Path("/dummy") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?" }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testSpecialTags( + @ApiParam(value = "client model" ,required=true) Client body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testSpecialTags(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApiService.java new file mode 100644 index 00000000000..eaec0e3e1ae --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/AnotherFakeApiService.java @@ -0,0 +1,25 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import com.sun.jersey.multipart.FormDataParam; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class AnotherFakeApiService { + public abstract Response testSpecialTags(Client body,SecurityContext securityContext) + throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/Bootstrap.java index 5e5532439b7..38a037ef487 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/Bootstrap.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/Bootstrap.java @@ -20,7 +20,7 @@ public void init(ServletConfig config) throws ServletException { .contact(new Contact() .email("apiteam@swagger.io")) .license(new License() - .name("Apache 2.0") + .name("Apache-2.0") .url("http://www.apache.org/licenses/LICENSE-2.0.html")); ServletContext context = config.getServletContext(); diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java new file mode 100644 index 00000000000..d44d5c06204 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.impl.AnotherFakeApiServiceImpl; + + +public class AnotherFakeApiServiceFactory { + private final static AnotherFakeApiService service = new AnotherFakeApiServiceImpl(); + + public static AnotherFakeApiService getAnotherFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..072d33568d4 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,29 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import com.sun.jersey.multipart.FormDataParam; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { + @Override + public Response testSpecialTags(Client body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..a671d04db60 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,69 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.factories.AnotherFakeApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.Client; + +import java.util.Map; +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.validation.constraints.*; + +@Path("/AnotherFake") + + +@io.swagger.annotations.Api(description = "the AnotherFake API") + +public class AnotherFakeApi { + private final AnotherFakeApiService delegate; + + public AnotherFakeApi(@Context ServletConfig servletContext) { + AnotherFakeApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("AnotherFakeApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (AnotherFakeApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi(); + } + + this.delegate = delegate; + } + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testSpecialTags(@ApiParam(value = "client model" ,required=true) Client body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testSpecialTags(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java new file mode 100644 index 00000000000..ca43c203e82 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/io/swagger/api/AnotherFakeApiService.java @@ -0,0 +1,21 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class AnotherFakeApiService { + public abstract Response testSpecialTags(Client body,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/Bootstrap.java index 5e5532439b7..38a037ef487 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/Bootstrap.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/Bootstrap.java @@ -20,7 +20,7 @@ public void init(ServletConfig config) throws ServletException { .contact(new Contact() .email("apiteam@swagger.io")) .license(new License() - .name("Apache 2.0") + .name("Apache-2.0") .url("http://www.apache.org/licenses/LICENSE-2.0.html")); ServletContext context = config.getServletContext(); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java new file mode 100644 index 00000000000..d44d5c06204 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.impl.AnotherFakeApiServiceImpl; + + +public class AnotherFakeApiServiceFactory { + private final static AnotherFakeApiService service = new AnotherFakeApiServiceImpl(); + + public static AnotherFakeApiService getAnotherFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..77b9e358572 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,25 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { + @Override + public Response testSpecialTags(Client body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..c79af3fc280 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,69 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.factories.AnotherFakeApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.Client; + +import java.util.Map; +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.validation.constraints.*; + +@Path("/another-fake") + + +@io.swagger.annotations.Api(description = "the another-fake API") + +public class AnotherFakeApi { + private final AnotherFakeApiService delegate; + + public AnotherFakeApi(@Context ServletConfig servletContext) { + AnotherFakeApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("AnotherFakeApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (AnotherFakeApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi(); + } + + this.delegate = delegate; + } + + @PATCH + @Path("/dummy") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testSpecialTags(@ApiParam(value = "client model" ,required=true) Client body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testSpecialTags(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApiService.java new file mode 100644 index 00000000000..ca43c203e82 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/AnotherFakeApiService.java @@ -0,0 +1,21 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class AnotherFakeApiService { + public abstract Response testSpecialTags(Client body,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java index 5e5532439b7..38a037ef487 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/Bootstrap.java @@ -20,7 +20,7 @@ public void init(ServletConfig config) throws ServletException { .contact(new Contact() .email("apiteam@swagger.io")) .license(new License() - .name("Apache 2.0") + .name("Apache-2.0") .url("http://www.apache.org/licenses/LICENSE-2.0.html")); ServletContext context = config.getServletContext(); diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java new file mode 100644 index 00000000000..d44d5c06204 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/AnotherFakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.AnotherFakeApiService; +import io.swagger.api.impl.AnotherFakeApiServiceImpl; + + +public class AnotherFakeApiServiceFactory { + private final static AnotherFakeApiService service = new AnotherFakeApiServiceImpl(); + + public static AnotherFakeApiService getAnotherFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..77b9e358572 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,25 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { + @Override + public Response testSpecialTags(Client body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..be61b2ad26e --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,44 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + default CompletableFuture> testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); + } + +} diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..82f8a98cfee --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,17 @@ +package io.swagger.api; + +import org.springframework.stereotype.Controller; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + +} diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 962607f9340..301e80043ba 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 8b927ffc8bf..974cc69fd3a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -33,7 +33,7 @@ public AdditionalPropertiesClass mapProperty(Map mapProperty) { public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { if (this.mapProperty == null) { - this.mapProperty = new HashMap(); + this.mapProperty = new HashMap<>(); } this.mapProperty.put(key, mapPropertyItem); return this; @@ -61,7 +61,7 @@ public AdditionalPropertiesClass mapOfMapProperty(Map mapOfMapPropertyItem) { if (this.mapOfMapProperty == null) { - this.mapOfMapProperty = new HashMap>(); + this.mapOfMapProperty = new HashMap<>(); } this.mapOfMapProperty.put(key, mapOfMapPropertyItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f313d21953d..4b4b1ed37c5 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -29,7 +29,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 1378caad6e3..83b4b8a89c6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -29,7 +29,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java index 5be7f764aa1..2546bfd53e1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java @@ -37,7 +37,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -65,7 +65,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -94,7 +94,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java index b83bdc9f1d0..f9dc285a7db 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java @@ -114,7 +114,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java index 4202d1248e0..c76210a27a3 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java @@ -65,7 +65,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -94,7 +94,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 443db4d4545..160cb38d9dc 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -80,7 +80,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index 2f4545d717a..406db97bb61 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -31,7 +31,7 @@ public class Pet { @JsonProperty("photoUrls") @Valid - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") @Valid @@ -168,7 +168,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..3b14b5b65c4 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,39 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..02fe84a126e --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,42 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 6a7e8c14be1..01bdae11a8e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..3b14b5b65c4 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,39 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..02fe84a126e --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,42 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 6a7e8c14be1..01bdae11a8e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..53bfedb21b8 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,43 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + default ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..b1b9e947700 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,44 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + private final AnotherFakeApiDelegate delegate; + + @org.springframework.beans.factory.annotation.Autowired + public AnotherFakeApiController(AnotherFakeApiDelegate delegate) { + this.delegate = delegate; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + return delegate.testSpecialTags(body); + } + +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java new file mode 100644 index 00000000000..2ff944839dc --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java @@ -0,0 +1,28 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * A delegate to be called by the {@link AnotherFakeApiController}}. + * Should be implemented as a controller but without the {@link org.springframework.stereotype.Controller} annotation. + * Instead, use spring to autowire this class into the {@link AnotherFakeApiController}. + */ + +public interface AnotherFakeApiDelegate { + + /** + * @see AnotherFakeApi#testSpecialTags + */ + default ResponseEntity testSpecialTags(Client body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 962607f9340..301e80043ba 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 8b927ffc8bf..974cc69fd3a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -33,7 +33,7 @@ public AdditionalPropertiesClass mapProperty(Map mapProperty) { public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { if (this.mapProperty == null) { - this.mapProperty = new HashMap(); + this.mapProperty = new HashMap<>(); } this.mapProperty.put(key, mapPropertyItem); return this; @@ -61,7 +61,7 @@ public AdditionalPropertiesClass mapOfMapProperty(Map mapOfMapPropertyItem) { if (this.mapOfMapProperty == null) { - this.mapOfMapProperty = new HashMap>(); + this.mapOfMapProperty = new HashMap<>(); } this.mapOfMapProperty.put(key, mapOfMapPropertyItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f313d21953d..4b4b1ed37c5 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -29,7 +29,7 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + this.arrayArrayNumber = new ArrayList<>(); } this.arrayArrayNumber.add(arrayArrayNumberItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index 1378caad6e3..83b4b8a89c6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -29,7 +29,7 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + this.arrayNumber = new ArrayList<>(); } this.arrayNumber.add(arrayNumberItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java index 5be7f764aa1..2546bfd53e1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java @@ -37,7 +37,7 @@ public ArrayTest arrayOfString(List arrayOfString) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + this.arrayOfString = new ArrayList<>(); } this.arrayOfString.add(arrayOfStringItem); return this; @@ -65,7 +65,7 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + this.arrayArrayOfInteger = new ArrayList<>(); } this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; @@ -94,7 +94,7 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + this.arrayArrayOfModel = new ArrayList<>(); } this.arrayArrayOfModel.add(arrayArrayOfModelItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java index b83bdc9f1d0..f9dc285a7db 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java @@ -114,7 +114,7 @@ public EnumArrays arrayEnum(List arrayEnum) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + this.arrayEnum = new ArrayList<>(); } this.arrayEnum.add(arrayEnumItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java index 4202d1248e0..c76210a27a3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java @@ -65,7 +65,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -94,7 +94,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 443db4d4545..160cb38d9dc 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -80,7 +80,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java index 2f4545d717a..406db97bb61 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java @@ -31,7 +31,7 @@ public class Pet { @JsonProperty("photoUrls") @Valid - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") @Valid @@ -168,7 +168,7 @@ public Pet tags(List tags) { public Pet addTagsItem(Tag tagsItem) { if (this.tags == null) { - this.tags = new ArrayList(); + this.tags = new ArrayList<>(); } this.tags.add(tagsItem); return this; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..3b14b5b65c4 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,39 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..b1b9e947700 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,44 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + private final AnotherFakeApiDelegate delegate; + + @org.springframework.beans.factory.annotation.Autowired + public AnotherFakeApiController(AnotherFakeApiDelegate delegate) { + this.delegate = delegate; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + return delegate.testSpecialTags(body); + } + +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java new file mode 100644 index 00000000000..b2b85be5817 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/AnotherFakeApiDelegate.java @@ -0,0 +1,24 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * A delegate to be called by the {@link AnotherFakeApiController}}. + * Should be implemented as a controller but without the {@link org.springframework.stereotype.Controller} annotation. + * Instead, use spring to autowire this class into the {@link AnotherFakeApiController}. + */ + +public interface AnotherFakeApiDelegate { + + /** + * @see AnotherFakeApi#testSpecialTags + */ + ResponseEntity testSpecialTags(Client body); + +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 6a7e8c14be1..01bdae11a8e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..d062a2914d4 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,42 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @ApiImplicitParams({ + + }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + +} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..02fe84a126e --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,42 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 6a7e8c14be1..01bdae11a8e 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..e629a1e2d31 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,40 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import java.util.Optional; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + +} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..6868090b4db --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,43 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Optional; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 6a7e8c14be1..01bdae11a8e 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0") diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApi.java new file mode 100644 index 00000000000..3b14b5b65c4 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApi.java @@ -0,0 +1,39 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Api(value = "another-fake", description = "the another-fake API") +public interface AnotherFakeApi { + + @ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..02fe84a126e --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/AnotherFakeApiController.java @@ -0,0 +1,42 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import javax.validation.constraints.*; +import javax.validation.Valid; + +@Controller +public class AnotherFakeApiController implements AnotherFakeApi { + private final ObjectMapper objectMapper; + + public AnotherFakeApiController(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public ResponseEntity testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, + @RequestHeader(value = "Accept", required = false) String accept) throws Exception { + // do some magic! + + if (accept != null && accept.contains("application/json")) { + return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"client\"}", Client.class), HttpStatus.OK); + } + + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java index 6a7e8c14be1..01bdae11a8e 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -18,7 +18,7 @@ ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Swagger Petstore") .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") - .license("Apache 2.0") + .license("Apache-2.0") .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") .termsOfServiceUrl("") .version("1.0.0")