update spring config to use java8 (#7308)

This commit is contained in:
William Cheng 2020-08-28 19:17:20 +08:00 committed by GitHub
parent 08fe44c764
commit 1f95199f82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 973 additions and 2068 deletions

View File

@ -5,5 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
artifactId: springboot-delegate artifactId: springboot-delegate
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"
java8: "false" java8: true
delegatePattern: "true" delegatePattern: "true"

View File

@ -4,7 +4,7 @@ library: spring-mvc
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
java8: "false" java8: true
booleanGetterPrefix: get booleanGetterPrefix: get
artifactId: spring-mvc-server artifactId: spring-mvc-server
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"

View File

@ -13,7 +13,6 @@ src/main/java/org/openapitools/api/StoreApi.java
src/main/java/org/openapitools/api/StoreApiController.java src/main/java/org/openapitools/api/StoreApiController.java
src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/api/UserApi.java
src/main/java/org/openapitools/api/UserApiController.java src/main/java/org/openapitools/api/UserApiController.java
src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java
src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/HomeController.java
src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java
src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java src/main/java/org/openapitools/configuration/OpenAPIUiConfiguration.java

View File

@ -123,9 +123,9 @@
<version>${springfox-version}</version> <version>${springfox-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.joschi.jackson</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-threetenbp-version}</version> <version>${jackson-version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
@ -152,7 +152,7 @@
</dependency> </dependency>
</dependencies> </dependencies>
<properties> <properties>
<java.version>1.7</java.version> <java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<jetty-version>9.2.15.v20160210</jetty-version> <jetty-version>9.2.15.v20160210</jetty-version>

View File

@ -7,20 +7,28 @@ package org.openapitools.api;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated @Validated
@Api(value = "another-fake", description = "the another-fake API") @Api(value = "another-fake", description = "the another-fake API")
public interface AnotherFakeApi { public interface AnotherFakeApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* PATCH /another-fake/dummy : To test special tags * PATCH /another-fake/dummy : To test special tags
* To test special tags and operation ID starting with number * To test special tags and operation ID starting with number
@ -36,6 +44,18 @@ public interface AnotherFakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); default ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,25 +1,9 @@
package org.openapitools.api; package org.openapitools.api;
import org.openapitools.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import java.util.Optional;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/}") @RequestMapping("${openapi.openAPIPetstore.base-path:/}")
@ -32,24 +16,9 @@ public class AnotherFakeApiController implements AnotherFakeApi {
this.request = request; this.request = request;
} }
/** @Override
* PATCH /another-fake/dummy : To test special tags public Optional<NativeWebRequest> getRequest() {
* To test special tags and operation ID starting with number return Optional.ofNullable(request);
*
* @param body client model (required)
* @return successful operation (status code 200)
* @see AnotherFakeApi#call123testSpecialTags
*/
public ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
} }
} }

View File

@ -8,29 +8,37 @@ package org.openapitools.api;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import org.openapitools.model.FileSchemaTestClass; import org.openapitools.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate; import java.time.LocalDate;
import java.util.Map; import java.util.Map;
import org.openapitools.model.ModelApiResponse; import org.openapitools.model.ModelApiResponse;
import org.threeten.bp.OffsetDateTime; import java.time.OffsetDateTime;
import org.openapitools.model.OuterComposite; import org.openapitools.model.OuterComposite;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.openapitools.model.User; import org.openapitools.model.User;
import org.openapitools.model.XmlItem; import org.openapitools.model.XmlItem;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated @Validated
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* POST /fake/create_xml_item : creates an XmlItem * POST /fake/create_xml_item : creates an XmlItem
* this route creates an XmlItem * this route creates an XmlItem
@ -45,7 +53,10 @@ public interface FakeApi {
value = "/fake/create_xml_item", value = "/fake/create_xml_item",
consumes = { "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" } consumes = { "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }
) )
ResponseEntity<Void> createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem); default ResponseEntity<Void> createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -62,7 +73,10 @@ public interface FakeApi {
value = "/fake/outer/boolean", value = "/fake/outer/boolean",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body); default ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -79,7 +93,19 @@ public interface FakeApi {
value = "/fake/outer/composite", value = "/fake/outer/composite",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body); default ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
ApiUtil.setExampleResponse(request, "*/*", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -96,7 +122,10 @@ public interface FakeApi {
value = "/fake/outer/number", value = "/fake/outer/number",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body); default ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -113,7 +142,10 @@ public interface FakeApi {
value = "/fake/outer/string", value = "/fake/outer/string",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body); default ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -130,7 +162,10 @@ public interface FakeApi {
value = "/fake/body-with-file-schema", value = "/fake/body-with-file-schema",
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Void> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body); default ResponseEntity<Void> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -147,7 +182,10 @@ public interface FakeApi {
value = "/fake/body-with-query-params", value = "/fake/body-with-query-params",
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Void> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body); default ResponseEntity<Void> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -165,7 +203,19 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); default ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -199,16 +249,19 @@ public interface FakeApi {
value = "/fake", value = "/fake",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "number", required = true) BigDecimal number,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "double", required = true) Double _double,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte,@ApiParam(value = "None") @Valid @RequestPart(value = "integer", required = false) Integer integer,@ApiParam(value = "None") @Valid @RequestPart(value = "int32", required = false) Integer int32,@ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64,@ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float,@ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string,@ApiParam(value = "None") @Valid @RequestPart(value = "binary", required = false) MultipartFile binary,@ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) LocalDate date,@ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) OffsetDateTime dateTime,@ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password,@ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback); default ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "number", required = true) BigDecimal number,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "double", required = true) Double _double,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte,@ApiParam(value = "None") @Valid @RequestPart(value = "integer", required = false) Integer integer,@ApiParam(value = "None") @Valid @RequestPart(value = "int32", required = false) Integer int32,@ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64,@ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float,@ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string,@ApiParam(value = "None") @Valid @RequestPart(value = "binary", required = false) MultipartFile binary,@ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) LocalDate date,@ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) OffsetDateTime dateTime,@ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password,@ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /fake : To test enum parameters * GET /fake : To test enum parameters
* To test enum parameters * To test enum parameters
* *
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;()) * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;&gt;())
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;()) * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;&gt;())
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional)
@ -225,7 +278,10 @@ public interface FakeApi {
value = "/fake", value = "/fake",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString); default ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -246,7 +302,10 @@ public interface FakeApi {
@DeleteMapping( @DeleteMapping(
value = "/fake" value = "/fake"
) )
ResponseEntity<Void> testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group); default ResponseEntity<Void> testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -262,7 +321,10 @@ public interface FakeApi {
value = "/fake/inline-additionalProperties", value = "/fake/inline-additionalProperties",
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Void> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map<String, String> param); default ResponseEntity<Void> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map<String, String> param) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -279,7 +341,10 @@ public interface FakeApi {
value = "/fake/jsonFormData", value = "/fake/jsonFormData",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> testJsonFormData(@ApiParam(value = "field1", required=true) @Valid @RequestPart(value = "param", required = true) String param,@ApiParam(value = "field2", required=true) @Valid @RequestPart(value = "param2", required = true) String param2); default ResponseEntity<Void> testJsonFormData(@ApiParam(value = "field1", required=true) @Valid @RequestPart(value = "param", required = true) String param,@ApiParam(value = "field2", required=true) @Valid @RequestPart(value = "param2", required = true) String param2) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -299,7 +364,10 @@ public interface FakeApi {
@PutMapping( @PutMapping(
value = "/fake/test-query-paramters" value = "/fake/test-query-paramters"
) )
ResponseEntity<Void> testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context); default ResponseEntity<Void> testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -323,6 +391,18 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "multipart/form-data" } consumes = { "multipart/form-data" }
) )
ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata); default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,35 +1,9 @@
package org.openapitools.api; package org.openapitools.api;
import java.math.BigDecimal;
import org.openapitools.model.Client;
import org.openapitools.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate;
import java.util.Map;
import org.openapitools.model.ModelApiResponse;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.model.OuterComposite;
import org.springframework.core.io.Resource;
import org.openapitools.model.User;
import org.openapitools.model.XmlItem;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import java.util.Optional;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/}") @RequestMapping("${openapi.openAPIPetstore.base-path:/}")
@ -42,251 +16,9 @@ public class FakeApiController implements FakeApi {
this.request = request; this.request = request;
} }
/** @Override
* POST /fake/create_xml_item : creates an XmlItem public Optional<NativeWebRequest> getRequest() {
* this route creates an XmlItem return Optional.ofNullable(request);
*
* @param xmlItem XmlItem Body (required)
* @return successful operation (status code 200)
* @see FakeApi#createXmlItem
*/
public ResponseEntity<Void> createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake/outer/boolean
* Test serialization of outer boolean types
*
* @param body Input boolean as post body (optional)
* @return Output boolean (status code 200)
* @see FakeApi#fakeOuterBooleanSerialize
*/
public ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake/outer/composite
* Test serialization of object with outer number type
*
* @param body Input composite as post body (optional)
* @return Output composite (status code 200)
* @see FakeApi#fakeOuterCompositeSerialize
*/
public ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
ApiUtil.setExampleResponse(request, "*/*", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake/outer/number
* Test serialization of outer number types
*
* @param body Input number as post body (optional)
* @return Output number (status code 200)
* @see FakeApi#fakeOuterNumberSerialize
*/
public ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake/outer/string
* Test serialization of outer string types
*
* @param body Input string as post body (optional)
* @return Output string (status code 200)
* @see FakeApi#fakeOuterStringSerialize
*/
public ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PUT /fake/body-with-file-schema
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @param body (required)
* @return Success (status code 200)
* @see FakeApi#testBodyWithFileSchema
*/
public ResponseEntity<Void> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PUT /fake/body-with-query-params
*
* @param query (required)
* @param body (required)
* @return Success (status code 200)
* @see FakeApi#testBodyWithQueryParams
*/
public ResponseEntity<Void> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PATCH /fake : To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model
*
* @param body client model (required)
* @return successful operation (status code 200)
* @see FakeApi#testClientModel
*/
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @param number None (required)
* @param _double None (required)
* @param patternWithoutDelimiter None (required)
* @param _byte None (required)
* @param integer None (optional)
* @param int32 None (optional)
* @param int64 None (optional)
* @param _float None (optional)
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param password None (optional)
* @param paramCallback None (optional)
* @return Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see FakeApi#testEndpointParameters
*/
public ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "number", required = true) BigDecimal number,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "double", required = true) Double _double,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte,@ApiParam(value = "None") @Valid @RequestPart(value = "integer", required = false) Integer integer,@ApiParam(value = "None") @Valid @RequestPart(value = "int32", required = false) Integer int32,@ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64,@ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float,@ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string,@ApiParam(value = "None") @Valid @RequestPart(value = "binary", required = false) MultipartFile binary,@ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) LocalDate date,@ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) OffsetDateTime dateTime,@ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password,@ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /fake : To test enum parameters
* To test enum parameters
*
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;())
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;())
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumFormStringArray Form parameter enum test (string array) (optional, default to $)
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @return Invalid request (status code 400)
* or Not found (status code 404)
* @see FakeApi#testEnumParameters
*/
public ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* DELETE /fake : Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
*
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @return Someting wrong (status code 400)
* @see FakeApi#testGroupParameters
*/
public ResponseEntity<Void> testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake/inline-additionalProperties : test inline additionalProperties
*
* @param param request body (required)
* @return successful operation (status code 200)
* @see FakeApi#testInlineAdditionalProperties
*/
public ResponseEntity<Void> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map<String, String> param) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /fake/jsonFormData : test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @return successful operation (status code 200)
* @see FakeApi#testJsonFormData
*/
public ResponseEntity<Void> testJsonFormData(@ApiParam(value = "field1", required=true) @Valid @RequestPart(value = "param", required = true) String param,@ApiParam(value = "field2", required=true) @Valid @RequestPart(value = "param2", required = true) String param2) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PUT /fake/test-query-paramters
* To test the collection format in query parameters
*
* @param pipe (required)
* @param ioutil (required)
* @param http (required)
* @param url (required)
* @param context (required)
* @return Success (status code 200)
* @see FakeApi#testQueryParameterCollectionFormat
*/
public ResponseEntity<Void> testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @return successful operation (status code 200)
* @see FakeApi#uploadFileWithRequiredFile
*/
public ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
} }
} }

View File

@ -7,20 +7,28 @@ package org.openapitools.api;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated @Validated
@Api(value = "fake_classname_test", description = "the fake_classname_test API") @Api(value = "fake_classname_test", description = "the fake_classname_test API")
public interface FakeClassnameTestApi { public interface FakeClassnameTestApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* PATCH /fake_classname_test : To test class name in snake case * PATCH /fake_classname_test : To test class name in snake case
* To test class name in snake case * To test class name in snake case
@ -38,6 +46,18 @@ public interface FakeClassnameTestApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); default ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,25 +1,9 @@
package org.openapitools.api; package org.openapitools.api;
import org.openapitools.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import java.util.Optional;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/}") @RequestMapping("${openapi.openAPIPetstore.base-path:/}")
@ -32,24 +16,9 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi {
this.request = request; this.request = request;
} }
/** @Override
* PATCH /fake_classname_test : To test class name in snake case public Optional<NativeWebRequest> getRequest() {
* To test class name in snake case return Optional.ofNullable(request);
*
* @param body client model (required)
* @return successful operation (status code 200)
* @see FakeClassnameTestApi#testClassname
*/
public ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
} }
} }

View File

@ -10,20 +10,28 @@ import org.openapitools.model.Pet;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import java.util.Set; import java.util.Set;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated @Validated
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* POST /pet : Add a new pet to the store * POST /pet : Add a new pet to the store
* *
@ -44,7 +52,10 @@ public interface PetApi {
value = "/pet", value = "/pet",
consumes = { "application/json", "application/xml" } consumes = { "application/json", "application/xml" }
) )
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); default ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -67,7 +78,10 @@ public interface PetApi {
@DeleteMapping( @DeleteMapping(
value = "/pet/{petId}" value = "/pet/{petId}"
) )
ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); default ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -91,7 +105,24 @@ public interface PetApi {
value = "/pet/findByStatus", value = "/pet/findByStatus",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<List<Pet>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status); default ResponseEntity<List<Pet>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -116,7 +147,24 @@ public interface PetApi {
value = "/pet/findByTags", value = "/pet/findByTags",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Set<Pet>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) Set<String> tags); default ResponseEntity<Set<Pet>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) Set<String> tags) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -139,7 +187,24 @@ public interface PetApi {
value = "/pet/{petId}", value = "/pet/{petId}",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); default ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -166,7 +231,10 @@ public interface PetApi {
value = "/pet", value = "/pet",
consumes = { "application/json", "application/xml" } consumes = { "application/json", "application/xml" }
) )
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); default ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -189,7 +257,10 @@ public interface PetApi {
value = "/pet/{petId}", value = "/pet/{petId}",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name,@ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status); default ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name,@ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -213,6 +284,18 @@ public interface PetApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "multipart/form-data" } consumes = { "multipart/form-data" }
) )
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "file", required = false) MultipartFile file); default ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "file", required = false) MultipartFile file) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,28 +1,9 @@
package org.openapitools.api; package org.openapitools.api;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.Pet;
import org.springframework.core.io.Resource;
import java.util.Set;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import java.util.Optional;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/}") @RequestMapping("${openapi.openAPIPetstore.base-path:/}")
@ -35,161 +16,9 @@ public class PetApiController implements PetApi {
this.request = request; this.request = request;
} }
/** @Override
* POST /pet : Add a new pet to the store public Optional<NativeWebRequest> getRequest() {
* return Optional.ofNullable(request);
* @param body Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid input (status code 405)
* @see PetApi#addPet
*/
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* DELETE /pet/{petId} : Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @return successful operation (status code 200)
* or Invalid pet value (status code 400)
* @see PetApi#deletePet
*/
public ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /pet/findByStatus : Finds Pets by status
* Multiple status values can be provided with comma separated strings
*
* @param status Status values that need to be considered for filter (required)
* @return successful operation (status code 200)
* or Invalid status value (status code 400)
* @see PetApi#findPetsByStatus
*/
public ResponseEntity<List<Pet>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /pet/findByTags : Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* @param tags Tags to filter by (required)
* @return successful operation (status code 200)
* or Invalid tag value (status code 400)
* @deprecated
* @see PetApi#findPetsByTags
*/
public ResponseEntity<Set<Pet>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) Set<String> tags) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /pet/{petId} : Find pet by ID
* Returns a single pet
*
* @param petId ID of pet to return (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
* @see PetApi#getPetById
*/
public ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PUT /pet : Update an existing pet
*
* @param body Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
* or Validation exception (status code 405)
* @see PetApi#updatePet
*/
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /pet/{petId} : Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return Invalid input (status code 405)
* @see PetApi#updatePetWithForm
*/
public ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name,@ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /pet/{petId}/uploadImage : uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return successful operation (status code 200)
* @see PetApi#uploadFile
*/
public ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "file", required = false) MultipartFile file) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
} }
} }

View File

@ -8,20 +8,28 @@ package org.openapitools.api;
import java.util.Map; import java.util.Map;
import org.openapitools.model.Order; import org.openapitools.model.Order;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated @Validated
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* DELETE /store/order/{order_id} : Delete purchase order by ID * DELETE /store/order/{order_id} : Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@ -37,7 +45,10 @@ public interface StoreApi {
@DeleteMapping( @DeleteMapping(
value = "/store/order/{order_id}" value = "/store/order/{order_id}"
) )
ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId); default ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -55,7 +66,10 @@ public interface StoreApi {
value = "/store/inventory", value = "/store/inventory",
produces = { "application/json" } produces = { "application/json" }
) )
ResponseEntity<Map<String, Integer>> getInventory(); default ResponseEntity<Map<String, Integer>> getInventory() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -76,7 +90,24 @@ public interface StoreApi {
value = "/store/order/{order_id}", value = "/store/order/{order_id}",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Order> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId); default ResponseEntity<Order> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -94,6 +125,23 @@ public interface StoreApi {
value = "/store/order", value = "/store/order",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); default ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,26 +1,9 @@
package org.openapitools.api; package org.openapitools.api;
import java.util.Map;
import org.openapitools.model.Order;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import java.util.Optional;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/}") @RequestMapping("${openapi.openAPIPetstore.base-path:/}")
@ -33,82 +16,9 @@ public class StoreApiController implements StoreApi {
this.request = request; this.request = request;
} }
/** @Override
* DELETE /store/order/{order_id} : Delete purchase order by ID public Optional<NativeWebRequest> getRequest() {
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors return Optional.ofNullable(request);
*
* @param orderId ID of the order that needs to be deleted (required)
* @return Invalid ID supplied (status code 400)
* or Order not found (status code 404)
* @see StoreApi#deleteOrder
*/
public ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /store/inventory : Returns pet inventories by status
* Returns a map of status codes to quantities
*
* @return successful operation (status code 200)
* @see StoreApi#getInventory
*/
public ResponseEntity<Map<String, Integer>> getInventory() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /store/order/{order_id} : Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
*
* @param orderId ID of pet that needs to be fetched (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Order not found (status code 404)
* @see StoreApi#getOrderById
*/
public ResponseEntity<Order> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /store/order : Place an order for a pet
*
* @param body order placed for purchasing the pet (required)
* @return successful operation (status code 200)
* or Invalid Order (status code 400)
* @see StoreApi#placeOrder
*/
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
} }
} }

View File

@ -8,20 +8,28 @@ package org.openapitools.api;
import java.util.List; import java.util.List;
import org.openapitools.model.User; import org.openapitools.model.User;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated @Validated
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* POST /user : Create user * POST /user : Create user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -35,7 +43,10 @@ public interface UserApi {
@PostMapping( @PostMapping(
value = "/user" value = "/user"
) )
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); default ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -50,7 +61,10 @@ public interface UserApi {
@PostMapping( @PostMapping(
value = "/user/createWithArray" value = "/user/createWithArray"
) )
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body); default ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -65,7 +79,10 @@ public interface UserApi {
@PostMapping( @PostMapping(
value = "/user/createWithList" value = "/user/createWithList"
) )
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body); default ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -83,7 +100,10 @@ public interface UserApi {
@DeleteMapping( @DeleteMapping(
value = "/user/{username}" value = "/user/{username}"
) )
ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); default ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -103,7 +123,24 @@ public interface UserApi {
value = "/user/{username}", value = "/user/{username}",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); default ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<User> <id>123456789</id> <username>aeiou</username> <firstName>aeiou</firstName> <lastName>aeiou</lastName> <email>aeiou</email> <password>aeiou</password> <phone>aeiou</phone> <userStatus>123</userStatus> </User>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -122,7 +159,10 @@ public interface UserApi {
value = "/user/login", value = "/user/login",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); default ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -136,7 +176,10 @@ public interface UserApi {
@GetMapping( @GetMapping(
value = "/user/logout" value = "/user/logout"
) )
ResponseEntity<Void> logoutUser(); default ResponseEntity<Void> logoutUser() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
@ -155,6 +198,9 @@ public interface UserApi {
@PutMapping( @PutMapping(
value = "/user/{username}" value = "/user/{username}"
) )
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); default ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,26 +1,9 @@
package org.openapitools.api; package org.openapitools.api;
import java.util.List;
import org.openapitools.model.User;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import java.util.Optional;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/}") @RequestMapping("${openapi.openAPIPetstore.base-path:/}")
@ -33,121 +16,9 @@ public class UserApiController implements UserApi {
this.request = request; this.request = request;
} }
/** @Override
* POST /user : Create user public Optional<NativeWebRequest> getRequest() {
* This can only be done by the logged in user. return Optional.ofNullable(request);
*
* @param body Created user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUser
*/
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /user/createWithArray : Creates list of users with given input array
*
* @param body List of user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUsersWithArrayInput
*/
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* POST /user/createWithList : Creates list of users with given input array
*
* @param body List of user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUsersWithListInput
*/
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* DELETE /user/{username} : Delete user
* This can only be done by the logged in user.
*
* @param username The name that needs to be deleted (required)
* @return Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#deleteUser
*/
public ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /user/{username} : Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return successful operation (status code 200)
* or Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#getUserByName
*/
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<User> <id>123456789</id> <username>aeiou</username> <firstName>aeiou</firstName> <lastName>aeiou</lastName> <email>aeiou</email> <password>aeiou</password> <phone>aeiou</phone> <userStatus>123</userStatus> </User>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /user/login : Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return successful operation (status code 200)
* or Invalid username/password supplied (status code 400)
* @see UserApi#loginUser
*/
public ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* GET /user/logout : Logs out current logged in user session
*
* @return successful operation (status code 200)
* @see UserApi#logoutUser
*/
public ResponseEntity<Void> logoutUser() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/**
* PUT /user/{username} : Updated user
* This can only be done by the logged in user.
*
* @param username name that need to be deleted (required)
* @param body Updated user object (required)
* @return Invalid user supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#updateUser
*/
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
} }
} }

View File

@ -1,232 +0,0 @@
package org.openapitools.configuration;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonTokenId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils;
import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase;
import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction;
import com.fasterxml.jackson.datatype.threetenbp.function.Function;
import org.threeten.bp.DateTimeException;
import org.threeten.bp.DateTimeUtils;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZonedDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.temporal.Temporal;
import org.threeten.bp.temporal.TemporalAccessor;
import java.io.IOException;
import java.math.BigDecimal;
/**
* Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s.
* Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format.
*
* @author Nick Williams
*/
public class CustomInstantDeserializer<T extends Temporal>
extends ThreeTenDateTimeDeserializerBase<T> {
private static final long serialVersionUID = 1L;
public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>(
Instant.class, DateTimeFormatter.ISO_INSTANT,
new Function<TemporalAccessor, Instant>() {
@Override
public Instant apply(TemporalAccessor temporalAccessor) {
return Instant.from(temporalAccessor);
}
},
new Function<FromIntegerArguments, Instant>() {
@Override
public Instant apply(FromIntegerArguments a) {
return Instant.ofEpochMilli(a.value);
}
},
new Function<FromDecimalArguments, Instant>() {
@Override
public Instant apply(FromDecimalArguments a) {
return Instant.ofEpochSecond(a.integer, a.fraction);
}
},
null
);
public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>(
OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME,
new Function<TemporalAccessor, OffsetDateTime>() {
@Override
public OffsetDateTime apply(TemporalAccessor temporalAccessor) {
return OffsetDateTime.from(temporalAccessor);
}
},
new Function<FromIntegerArguments, OffsetDateTime>() {
@Override
public OffsetDateTime apply(FromIntegerArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
new Function<FromDecimalArguments, OffsetDateTime>() {
@Override
public OffsetDateTime apply(FromDecimalArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() {
@Override
public OffsetDateTime apply(OffsetDateTime d, ZoneId z) {
return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()));
}
}
);
public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>(
ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME,
new Function<TemporalAccessor, ZonedDateTime>() {
@Override
public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
return ZonedDateTime.from(temporalAccessor);
}
},
new Function<FromIntegerArguments, ZonedDateTime>() {
@Override
public ZonedDateTime apply(FromIntegerArguments a) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
new Function<FromDecimalArguments, ZonedDateTime>() {
@Override
public ZonedDateTime apply(FromDecimalArguments a) {
return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() {
@Override
public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) {
return zonedDateTime.withZoneSameInstant(zoneId);
}
}
);
protected final Function<FromIntegerArguments, T> fromMilliseconds;
protected final Function<FromDecimalArguments, T> fromNanoseconds;
protected final Function<TemporalAccessor, T> parsedToValue;
protected final BiFunction<T, ZoneId, T> adjust;
protected CustomInstantDeserializer(Class<T> supportedType,
DateTimeFormatter parser,
Function<TemporalAccessor, T> parsedToValue,
Function<FromIntegerArguments, T> fromMilliseconds,
Function<FromDecimalArguments, T> fromNanoseconds,
BiFunction<T, ZoneId, T> adjust) {
super(supportedType, parser);
this.parsedToValue = parsedToValue;
this.fromMilliseconds = fromMilliseconds;
this.fromNanoseconds = fromNanoseconds;
this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() {
@Override
public T apply(T t, ZoneId zoneId) {
return t;
}
} : adjust;
}
@SuppressWarnings("unchecked")
protected CustomInstantDeserializer(CustomInstantDeserializer<T> base, DateTimeFormatter f) {
super((Class<T>) base.handledType(), f);
parsedToValue = base.parsedToValue;
fromMilliseconds = base.fromMilliseconds;
fromNanoseconds = base.fromNanoseconds;
adjust = base.adjust;
}
@Override
protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) {
if (dtf == _formatter) {
return this;
}
return new CustomInstantDeserializer<T>(this, dtf);
}
@Override
public T deserialize(JsonParser parser, DeserializationContext context) throws IOException {
//NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only
//string values have to be adjusted to the configured TZ.
switch (parser.getCurrentTokenId()) {
case JsonTokenId.ID_NUMBER_FLOAT: {
BigDecimal value = parser.getDecimalValue();
long seconds = value.longValue();
int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds);
return fromNanoseconds.apply(new FromDecimalArguments(
seconds, nanoseconds, getZone(context)));
}
case JsonTokenId.ID_NUMBER_INT: {
long timestamp = parser.getLongValue();
if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) {
return this.fromNanoseconds.apply(new FromDecimalArguments(
timestamp, 0, this.getZone(context)
));
}
return this.fromMilliseconds.apply(new FromIntegerArguments(
timestamp, this.getZone(context)
));
}
case JsonTokenId.ID_STRING: {
String string = parser.getText().trim();
if (string.length() == 0) {
return null;
}
if (string.endsWith("+0000")) {
string = string.substring(0, string.length() - 5) + "Z";
}
T value;
try {
TemporalAccessor acc = _formatter.parse(string);
value = parsedToValue.apply(acc);
if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) {
return adjust.apply(value, this.getZone(context));
}
} catch (DateTimeException e) {
throw _peelDTE(e);
}
return value;
}
}
throw context.mappingException("Expected type float, integer, or string.");
}
private ZoneId getZone(DeserializationContext context) {
// Instants are always in UTC, so don't waste compute cycles
return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone());
}
private static class FromIntegerArguments {
public final long value;
public final ZoneId zoneId;
private FromIntegerArguments(long value, ZoneId zoneId) {
this.value = value;
this.zoneId = zoneId;
}
}
private static class FromDecimalArguments {
public final long integer;
public final int fraction;
public final ZoneId zoneId;
private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) {
this.integer = integer;
this.fraction = fraction;
this.zoneId = zoneId;
}
}
}

View File

@ -40,8 +40,9 @@ public class OpenAPIDocumentationConfig {
.select() .select()
.apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) .apis(RequestHandlerSelectors.basePackage("org.openapitools.api"))
.build() .build()
.directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class) .pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath))
.directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class) .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
.apiInfo(apiInfo()); .apiInfo(apiInfo());
} }

View File

@ -2,7 +2,6 @@ package org.openapitools.configuration;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import org.openapitools.jackson.nullable.JsonNullableModule; import org.openapitools.jackson.nullable.JsonNullableModule;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -16,9 +15,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZonedDateTime;
import java.util.List; import java.util.List;
@ -73,14 +69,10 @@ public class OpenAPIUiConfiguration extends WebMvcConfigurerAdapter {
@Bean @Bean
public Jackson2ObjectMapperBuilder builder() { public Jackson2ObjectMapperBuilder builder() {
ThreeTenModule module = new ThreeTenModule();
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
return new Jackson2ObjectMapperBuilder() return new Jackson2ObjectMapperBuilder()
.indentOutput(true) .indentOutput(true)
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.modulesToInstall(module, new JsonNullableModule()) .modulesToInstall(new JsonNullableModule())
.dateFormat(new RFC3339DateFormat()); .dateFormat(new RFC3339DateFormat());
} }

View File

@ -68,7 +68,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) {
if (this.mapString == null) { if (this.mapString == null) {
this.mapString = new HashMap<String, String>(); this.mapString = new HashMap<>();
} }
this.mapString.put(key, mapStringItem); this.mapString.put(key, mapStringItem);
return this; return this;
@ -96,7 +96,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) {
if (this.mapNumber == null) { if (this.mapNumber == null) {
this.mapNumber = new HashMap<String, BigDecimal>(); this.mapNumber = new HashMap<>();
} }
this.mapNumber.put(key, mapNumberItem); this.mapNumber.put(key, mapNumberItem);
return this; return this;
@ -125,7 +125,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) {
if (this.mapInteger == null) { if (this.mapInteger == null) {
this.mapInteger = new HashMap<String, Integer>(); this.mapInteger = new HashMap<>();
} }
this.mapInteger.put(key, mapIntegerItem); this.mapInteger.put(key, mapIntegerItem);
return this; return this;
@ -153,7 +153,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) {
if (this.mapBoolean == null) { if (this.mapBoolean == null) {
this.mapBoolean = new HashMap<String, Boolean>(); this.mapBoolean = new HashMap<>();
} }
this.mapBoolean.put(key, mapBooleanItem); this.mapBoolean.put(key, mapBooleanItem);
return this; return this;
@ -181,7 +181,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) { public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) {
if (this.mapArrayInteger == null) { if (this.mapArrayInteger == null) {
this.mapArrayInteger = new HashMap<String, List<Integer>>(); this.mapArrayInteger = new HashMap<>();
} }
this.mapArrayInteger.put(key, mapArrayIntegerItem); this.mapArrayInteger.put(key, mapArrayIntegerItem);
return this; return this;
@ -210,7 +210,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) { public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) {
if (this.mapArrayAnytype == null) { if (this.mapArrayAnytype == null) {
this.mapArrayAnytype = new HashMap<String, List<Object>>(); this.mapArrayAnytype = new HashMap<>();
} }
this.mapArrayAnytype.put(key, mapArrayAnytypeItem); this.mapArrayAnytype.put(key, mapArrayAnytypeItem);
return this; return this;
@ -239,7 +239,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) { public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) {
if (this.mapMapString == null) { if (this.mapMapString == null) {
this.mapMapString = new HashMap<String, Map<String, String>>(); this.mapMapString = new HashMap<>();
} }
this.mapMapString.put(key, mapMapStringItem); this.mapMapString.put(key, mapMapStringItem);
return this; return this;
@ -268,7 +268,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) { public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) {
if (this.mapMapAnytype == null) { if (this.mapMapAnytype == null) {
this.mapMapAnytype = new HashMap<String, Map<String, Object>>(); this.mapMapAnytype = new HashMap<>();
} }
this.mapMapAnytype.put(key, mapMapAnytypeItem); this.mapMapAnytype.put(key, mapMapAnytypeItem);
return this; return this;

View File

@ -30,7 +30,7 @@ public class ArrayOfArrayOfNumberOnly {
public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) { public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) { if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>(); this.arrayArrayNumber = new ArrayList<>();
} }
this.arrayArrayNumber.add(arrayArrayNumberItem); this.arrayArrayNumber.add(arrayArrayNumberItem);
return this; return this;

View File

@ -30,7 +30,7 @@ public class ArrayOfNumberOnly {
public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) { if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<BigDecimal>(); this.arrayNumber = new ArrayList<>();
} }
this.arrayNumber.add(arrayNumberItem); this.arrayNumber.add(arrayNumberItem);
return this; return this;

View File

@ -38,7 +38,7 @@ public class ArrayTest {
public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
if (this.arrayOfString == null) { if (this.arrayOfString == null) {
this.arrayOfString = new ArrayList<String>(); this.arrayOfString = new ArrayList<>();
} }
this.arrayOfString.add(arrayOfStringItem); this.arrayOfString.add(arrayOfStringItem);
return this; return this;
@ -66,7 +66,7 @@ public class ArrayTest {
public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) { public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
if (this.arrayArrayOfInteger == null) { if (this.arrayArrayOfInteger == null) {
this.arrayArrayOfInteger = new ArrayList<List<Long>>(); this.arrayArrayOfInteger = new ArrayList<>();
} }
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this; return this;
@ -95,7 +95,7 @@ public class ArrayTest {
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) { public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) { if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>(); this.arrayArrayOfModel = new ArrayList<>();
} }
this.arrayArrayOfModel.add(arrayArrayOfModelItem); this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this; return this;

View File

@ -123,7 +123,7 @@ public class EnumArrays {
public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) {
if (this.arrayEnum == null) { if (this.arrayEnum == null) {
this.arrayEnum = new ArrayList<ArrayEnumEnum>(); this.arrayEnum = new ArrayList<>();
} }
this.arrayEnum.add(arrayEnumItem); this.arrayEnum.add(arrayEnumItem);
return this; return this;

View File

@ -53,7 +53,7 @@ public class FileSchemaTestClass {
public FileSchemaTestClass addFilesItem(java.io.File filesItem) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
if (this.files == null) { if (this.files == null) {
this.files = new ArrayList<java.io.File>(); this.files = new ArrayList<>();
} }
this.files.add(filesItem); this.files.add(filesItem);
return this; return this;

View File

@ -6,10 +6,10 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.UUID; import java.util.UUID;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;

View File

@ -78,7 +78,7 @@ public class MapTest {
public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) { public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
if (this.mapMapOfString == null) { if (this.mapMapOfString == null) {
this.mapMapOfString = new HashMap<String, Map<String, String>>(); this.mapMapOfString = new HashMap<>();
} }
this.mapMapOfString.put(key, mapMapOfStringItem); this.mapMapOfString.put(key, mapMapOfStringItem);
return this; return this;
@ -107,7 +107,7 @@ public class MapTest {
public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
if (this.mapOfEnumString == null) { if (this.mapOfEnumString == null) {
this.mapOfEnumString = new HashMap<String, InnerEnum>(); this.mapOfEnumString = new HashMap<>();
} }
this.mapOfEnumString.put(key, mapOfEnumStringItem); this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this; return this;
@ -135,7 +135,7 @@ public class MapTest {
public MapTest putDirectMapItem(String key, Boolean directMapItem) { public MapTest putDirectMapItem(String key, Boolean directMapItem) {
if (this.directMap == null) { if (this.directMap == null) {
this.directMap = new HashMap<String, Boolean>(); this.directMap = new HashMap<>();
} }
this.directMap.put(key, directMapItem); this.directMap.put(key, directMapItem);
return this; return this;
@ -163,7 +163,7 @@ public class MapTest {
public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) {
if (this.indirectMap == null) { if (this.indirectMap == null) {
this.indirectMap = new HashMap<String, Boolean>(); this.indirectMap = new HashMap<>();
} }
this.indirectMap.put(key, indirectMapItem); this.indirectMap.put(key, indirectMapItem);
return this; return this;

View File

@ -5,12 +5,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.time.OffsetDateTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.openapitools.model.Animal; import org.openapitools.model.Animal;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@ -82,7 +82,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
if (this.map == null) { if (this.map == null) {
this.map = new HashMap<String, Animal>(); this.map = new HashMap<>();
} }
this.map.put(key, mapItem); this.map.put(key, mapItem);
return this; return this;

View File

@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.threeten.bp.OffsetDateTime; import java.time.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;

View File

@ -34,7 +34,7 @@ public class Pet {
@JsonProperty("photoUrls") @JsonProperty("photoUrls")
@Valid @Valid
private Set<String> photoUrls = new LinkedHashSet<String>(); private Set<String> photoUrls = new LinkedHashSet<>();
@JsonProperty("tags") @JsonProperty("tags")
@Valid @Valid
@ -175,7 +175,7 @@ public class Pet {
public Pet addTagsItem(Tag tagsItem) { public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) { if (this.tags == null) {
this.tags = new ArrayList<Tag>(); this.tags = new ArrayList<>();
} }
this.tags.add(tagsItem); this.tags.add(tagsItem);
return this; return this;

View File

@ -33,7 +33,7 @@ public class TypeHolderDefault {
@JsonProperty("array_item") @JsonProperty("array_item")
@Valid @Valid
private List<Integer> arrayItem = new ArrayList<Integer>(); private List<Integer> arrayItem = new ArrayList<>();
public TypeHolderDefault stringItem(String stringItem) { public TypeHolderDefault stringItem(String stringItem) {
this.stringItem = stringItem; this.stringItem = stringItem;

View File

@ -36,7 +36,7 @@ public class TypeHolderExample {
@JsonProperty("array_item") @JsonProperty("array_item")
@Valid @Valid
private List<Integer> arrayItem = new ArrayList<Integer>(); private List<Integer> arrayItem = new ArrayList<>();
public TypeHolderExample stringItem(String stringItem) { public TypeHolderExample stringItem(String stringItem) {
this.stringItem = stringItem; this.stringItem = stringItem;

View File

@ -203,7 +203,7 @@ public class XmlItem {
public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) {
if (this.wrappedArray == null) { if (this.wrappedArray == null) {
this.wrappedArray = new ArrayList<Integer>(); this.wrappedArray = new ArrayList<>();
} }
this.wrappedArray.add(wrappedArrayItem); this.wrappedArray.add(wrappedArrayItem);
return this; return this;
@ -312,7 +312,7 @@ public class XmlItem {
public XmlItem addNameArrayItem(Integer nameArrayItem) { public XmlItem addNameArrayItem(Integer nameArrayItem) {
if (this.nameArray == null) { if (this.nameArray == null) {
this.nameArray = new ArrayList<Integer>(); this.nameArray = new ArrayList<>();
} }
this.nameArray.add(nameArrayItem); this.nameArray.add(nameArrayItem);
return this; return this;
@ -340,7 +340,7 @@ public class XmlItem {
public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) {
if (this.nameWrappedArray == null) { if (this.nameWrappedArray == null) {
this.nameWrappedArray = new ArrayList<Integer>(); this.nameWrappedArray = new ArrayList<>();
} }
this.nameWrappedArray.add(nameWrappedArrayItem); this.nameWrappedArray.add(nameWrappedArrayItem);
return this; return this;
@ -449,7 +449,7 @@ public class XmlItem {
public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) {
if (this.prefixArray == null) { if (this.prefixArray == null) {
this.prefixArray = new ArrayList<Integer>(); this.prefixArray = new ArrayList<>();
} }
this.prefixArray.add(prefixArrayItem); this.prefixArray.add(prefixArrayItem);
return this; return this;
@ -477,7 +477,7 @@ public class XmlItem {
public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) {
if (this.prefixWrappedArray == null) { if (this.prefixWrappedArray == null) {
this.prefixWrappedArray = new ArrayList<Integer>(); this.prefixWrappedArray = new ArrayList<>();
} }
this.prefixWrappedArray.add(prefixWrappedArrayItem); this.prefixWrappedArray.add(prefixWrappedArrayItem);
return this; return this;
@ -586,7 +586,7 @@ public class XmlItem {
public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) {
if (this.namespaceArray == null) { if (this.namespaceArray == null) {
this.namespaceArray = new ArrayList<Integer>(); this.namespaceArray = new ArrayList<>();
} }
this.namespaceArray.add(namespaceArrayItem); this.namespaceArray.add(namespaceArrayItem);
return this; return this;
@ -614,7 +614,7 @@ public class XmlItem {
public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) {
if (this.namespaceWrappedArray == null) { if (this.namespaceWrappedArray == null) {
this.namespaceWrappedArray = new ArrayList<Integer>(); this.namespaceWrappedArray = new ArrayList<>();
} }
this.namespaceWrappedArray.add(namespaceWrappedArrayItem); this.namespaceWrappedArray.add(namespaceWrappedArrayItem);
return this; return this;
@ -723,7 +723,7 @@ public class XmlItem {
public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) {
if (this.prefixNsArray == null) { if (this.prefixNsArray == null) {
this.prefixNsArray = new ArrayList<Integer>(); this.prefixNsArray = new ArrayList<>();
} }
this.prefixNsArray.add(prefixNsArrayItem); this.prefixNsArray.add(prefixNsArrayItem);
return this; return this;
@ -751,7 +751,7 @@ public class XmlItem {
public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) {
if (this.prefixNsWrappedArray == null) { if (this.prefixNsWrappedArray == null) {
this.prefixNsWrappedArray = new ArrayList<Integer>(); this.prefixNsWrappedArray = new ArrayList<>();
} }
this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem);
return this; return this;

View File

@ -21,9 +21,7 @@ src/main/java/org/openapitools/api/StoreApiDelegate.java
src/main/java/org/openapitools/api/UserApi.java src/main/java/org/openapitools/api/UserApi.java
src/main/java/org/openapitools/api/UserApiController.java src/main/java/org/openapitools/api/UserApiController.java
src/main/java/org/openapitools/api/UserApiDelegate.java src/main/java/org/openapitools/api/UserApiDelegate.java
src/main/java/org/openapitools/configuration/CustomInstantDeserializer.java
src/main/java/org/openapitools/configuration/HomeController.java src/main/java/org/openapitools/configuration/HomeController.java
src/main/java/org/openapitools/configuration/JacksonConfiguration.java
src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java
src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java
src/main/java/org/openapitools/model/AdditionalPropertiesArray.java src/main/java/org/openapitools/model/AdditionalPropertiesArray.java

View File

@ -6,7 +6,7 @@
<name>springboot-delegate</name> <name>springboot-delegate</name>
<version>1.0.0</version> <version>1.0.0</version>
<properties> <properties>
<java.version>1.7</java.version> <java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.8.0</springfox-version> <springfox-version>2.8.0</springfox-version>
@ -14,7 +14,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version> <version>2.0.1.RELEASE</version>
</parent> </parent>
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
@ -54,9 +54,8 @@
<version>2.2.11</version> <version>2.2.11</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.joschi.jackson</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-threetenbp</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
<version>2.8.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>

View File

@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@SpringBootApplication @SpringBootApplication
@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) @ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"})
@ -39,7 +38,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
@Bean @Bean
public WebMvcConfigurer webConfigurer() { public WebMvcConfigurer webConfigurer() {
return new WebMvcConfigurerAdapter() { return new WebMvcConfigurer() {
/*@Override /*@Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") registry.addMapping("/**")

View File

@ -21,6 +21,10 @@ import java.util.Map;
@Api(value = "another-fake", description = "the another-fake API") @Api(value = "another-fake", description = "the another-fake API")
public interface AnotherFakeApi { public interface AnotherFakeApi {
default AnotherFakeApiDelegate getDelegate() {
return new AnotherFakeApiDelegate() {};
}
/** /**
* PATCH /another-fake/dummy : To test special tags * PATCH /another-fake/dummy : To test special tags
* To test special tags and operation ID starting with number * To test special tags and operation ID starting with number
@ -36,6 +40,8 @@ public interface AnotherFakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); default ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
return getDelegate().call123testSpecialTags(body);
}
} }

View File

@ -1,24 +1,8 @@
package org.openapitools.api; package org.openapitools.api;
import org.openapitools.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue; import java.util.Optional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
@ -27,19 +11,12 @@ public class AnotherFakeApiController implements AnotherFakeApi {
private final AnotherFakeApiDelegate delegate; private final AnotherFakeApiDelegate delegate;
public AnotherFakeApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) AnotherFakeApiDelegate delegate) { public AnotherFakeApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) AnotherFakeApiDelegate delegate) {
this.delegate = delegate; this.delegate = Optional.ofNullable(delegate).orElse(new AnotherFakeApiDelegate() {});
} }
/** @Override
* PATCH /another-fake/dummy : To test special tags public AnotherFakeApiDelegate getDelegate() {
* To test special tags and operation ID starting with number return delegate;
*
* @param body client model (required)
* @return successful operation (status code 200)
* @see AnotherFakeApi#call123testSpecialTags
*/
public ResponseEntity<Client> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
return delegate.call123testSpecialTags(body);
} }
} }

View File

@ -2,11 +2,15 @@ package org.openapitools.api;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* A delegate to be called by the {@link AnotherFakeApiController}}. * A delegate to be called by the {@link AnotherFakeApiController}}.
@ -15,6 +19,10 @@ import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface AnotherFakeApiDelegate { public interface AnotherFakeApiDelegate {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* PATCH /another-fake/dummy : To test special tags * PATCH /another-fake/dummy : To test special tags
* To test special tags and operation ID starting with number * To test special tags and operation ID starting with number
@ -23,6 +31,18 @@ public interface AnotherFakeApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see AnotherFakeApi#call123testSpecialTags * @see AnotherFakeApi#call123testSpecialTags
*/ */
ResponseEntity<Client> call123testSpecialTags(Client body); default ResponseEntity<Client> call123testSpecialTags(Client body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -8,10 +8,10 @@ package org.openapitools.api;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import org.openapitools.model.FileSchemaTestClass; import org.openapitools.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate; import java.time.LocalDate;
import java.util.Map; import java.util.Map;
import org.openapitools.model.ModelApiResponse; import org.openapitools.model.ModelApiResponse;
import org.threeten.bp.OffsetDateTime; import java.time.OffsetDateTime;
import org.openapitools.model.OuterComposite; import org.openapitools.model.OuterComposite;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.openapitools.model.User; import org.openapitools.model.User;
@ -31,6 +31,10 @@ import java.util.Map;
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
default FakeApiDelegate getDelegate() {
return new FakeApiDelegate() {};
}
/** /**
* POST /fake/create_xml_item : creates an XmlItem * POST /fake/create_xml_item : creates an XmlItem
* this route creates an XmlItem * this route creates an XmlItem
@ -45,7 +49,9 @@ public interface FakeApi {
value = "/fake/create_xml_item", value = "/fake/create_xml_item",
consumes = { "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" } consumes = { "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }
) )
ResponseEntity<Void> createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem); default ResponseEntity<Void> createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) {
return getDelegate().createXmlItem(xmlItem);
}
/** /**
@ -62,7 +68,9 @@ public interface FakeApi {
value = "/fake/outer/boolean", value = "/fake/outer/boolean",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body); default ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body) {
return getDelegate().fakeOuterBooleanSerialize(body);
}
/** /**
@ -79,7 +87,9 @@ public interface FakeApi {
value = "/fake/outer/composite", value = "/fake/outer/composite",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body); default ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body) {
return getDelegate().fakeOuterCompositeSerialize(body);
}
/** /**
@ -96,7 +106,9 @@ public interface FakeApi {
value = "/fake/outer/number", value = "/fake/outer/number",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body); default ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body) {
return getDelegate().fakeOuterNumberSerialize(body);
}
/** /**
@ -113,7 +125,9 @@ public interface FakeApi {
value = "/fake/outer/string", value = "/fake/outer/string",
produces = { "*/*" } produces = { "*/*" }
) )
ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body); default ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body) {
return getDelegate().fakeOuterStringSerialize(body);
}
/** /**
@ -130,7 +144,9 @@ public interface FakeApi {
value = "/fake/body-with-file-schema", value = "/fake/body-with-file-schema",
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Void> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body); default ResponseEntity<Void> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) {
return getDelegate().testBodyWithFileSchema(body);
}
/** /**
@ -147,7 +163,9 @@ public interface FakeApi {
value = "/fake/body-with-query-params", value = "/fake/body-with-query-params",
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Void> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body); default ResponseEntity<Void> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) {
return getDelegate().testBodyWithQueryParams(query, body);
}
/** /**
@ -165,7 +183,9 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); default ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
return getDelegate().testClientModel(body);
}
/** /**
@ -199,16 +219,18 @@ public interface FakeApi {
value = "/fake", value = "/fake",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "number", required = true) BigDecimal number,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "double", required = true) Double _double,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte,@ApiParam(value = "None") @Valid @RequestPart(value = "integer", required = false) Integer integer,@ApiParam(value = "None") @Valid @RequestPart(value = "int32", required = false) Integer int32,@ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64,@ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float,@ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string,@ApiParam(value = "None") @Valid @RequestPart(value = "binary", required = false) MultipartFile binary,@ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) LocalDate date,@ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) OffsetDateTime dateTime,@ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password,@ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback); default ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "number", required = true) BigDecimal number,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "double", required = true) Double _double,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte,@ApiParam(value = "None") @Valid @RequestPart(value = "integer", required = false) Integer integer,@ApiParam(value = "None") @Valid @RequestPart(value = "int32", required = false) Integer int32,@ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64,@ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float,@ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string,@ApiParam(value = "None") @Valid @RequestPart(value = "binary", required = false) MultipartFile binary,@ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) LocalDate date,@ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) OffsetDateTime dateTime,@ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password,@ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback) {
return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
}
/** /**
* GET /fake : To test enum parameters * GET /fake : To test enum parameters
* To test enum parameters * To test enum parameters
* *
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;()) * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;&gt;())
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;()) * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;&gt;())
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional)
@ -225,7 +247,9 @@ public interface FakeApi {
value = "/fake", value = "/fake",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString); default ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString) {
return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
}
/** /**
@ -246,7 +270,9 @@ public interface FakeApi {
@DeleteMapping( @DeleteMapping(
value = "/fake" value = "/fake"
) )
ResponseEntity<Void> testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group); default ResponseEntity<Void> testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) {
return getDelegate().testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
}
/** /**
@ -262,7 +288,9 @@ public interface FakeApi {
value = "/fake/inline-additionalProperties", value = "/fake/inline-additionalProperties",
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Void> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map<String, String> param); default ResponseEntity<Void> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map<String, String> param) {
return getDelegate().testInlineAdditionalProperties(param);
}
/** /**
@ -279,7 +307,9 @@ public interface FakeApi {
value = "/fake/jsonFormData", value = "/fake/jsonFormData",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> testJsonFormData(@ApiParam(value = "field1", required=true) @Valid @RequestPart(value = "param", required = true) String param,@ApiParam(value = "field2", required=true) @Valid @RequestPart(value = "param2", required = true) String param2); default ResponseEntity<Void> testJsonFormData(@ApiParam(value = "field1", required=true) @Valid @RequestPart(value = "param", required = true) String param,@ApiParam(value = "field2", required=true) @Valid @RequestPart(value = "param2", required = true) String param2) {
return getDelegate().testJsonFormData(param, param2);
}
/** /**
@ -299,7 +329,9 @@ public interface FakeApi {
@PutMapping( @PutMapping(
value = "/fake/test-query-paramters" value = "/fake/test-query-paramters"
) )
ResponseEntity<Void> testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context); default ResponseEntity<Void> testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context) {
return getDelegate().testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
}
/** /**
@ -323,6 +355,8 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "multipart/form-data" } consumes = { "multipart/form-data" }
) )
ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata); default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata) {
return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
}
} }

View File

@ -1,34 +1,8 @@
package org.openapitools.api; package org.openapitools.api;
import java.math.BigDecimal;
import org.openapitools.model.Client;
import org.openapitools.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate;
import java.util.Map;
import org.openapitools.model.ModelApiResponse;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.model.OuterComposite;
import org.springframework.core.io.Resource;
import org.openapitools.model.User;
import org.openapitools.model.XmlItem;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue; import java.util.Optional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
@ -37,218 +11,12 @@ public class FakeApiController implements FakeApi {
private final FakeApiDelegate delegate; private final FakeApiDelegate delegate;
public FakeApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) FakeApiDelegate delegate) { public FakeApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) FakeApiDelegate delegate) {
this.delegate = delegate; this.delegate = Optional.ofNullable(delegate).orElse(new FakeApiDelegate() {});
} }
/** @Override
* POST /fake/create_xml_item : creates an XmlItem public FakeApiDelegate getDelegate() {
* this route creates an XmlItem return delegate;
*
* @param xmlItem XmlItem Body (required)
* @return successful operation (status code 200)
* @see FakeApi#createXmlItem
*/
public ResponseEntity<Void> createXmlItem(@ApiParam(value = "XmlItem Body" ,required=true ) @Valid @RequestBody XmlItem xmlItem) {
return delegate.createXmlItem(xmlItem);
}
/**
* POST /fake/outer/boolean
* Test serialization of outer boolean types
*
* @param body Input boolean as post body (optional)
* @return Output boolean (status code 200)
* @see FakeApi#fakeOuterBooleanSerialize
*/
public ResponseEntity<Boolean> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody(required = false) Boolean body) {
return delegate.fakeOuterBooleanSerialize(body);
}
/**
* POST /fake/outer/composite
* Test serialization of object with outer number type
*
* @param body Input composite as post body (optional)
* @return Output composite (status code 200)
* @see FakeApi#fakeOuterCompositeSerialize
*/
public ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody(required = false) OuterComposite body) {
return delegate.fakeOuterCompositeSerialize(body);
}
/**
* POST /fake/outer/number
* Test serialization of outer number types
*
* @param body Input number as post body (optional)
* @return Output number (status code 200)
* @see FakeApi#fakeOuterNumberSerialize
*/
public ResponseEntity<BigDecimal> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody(required = false) BigDecimal body) {
return delegate.fakeOuterNumberSerialize(body);
}
/**
* POST /fake/outer/string
* Test serialization of outer string types
*
* @param body Input string as post body (optional)
* @return Output string (status code 200)
* @see FakeApi#fakeOuterStringSerialize
*/
public ResponseEntity<String> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody(required = false) String body) {
return delegate.fakeOuterStringSerialize(body);
}
/**
* PUT /fake/body-with-file-schema
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @param body (required)
* @return Success (status code 200)
* @see FakeApi#testBodyWithFileSchema
*/
public ResponseEntity<Void> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass body) {
return delegate.testBodyWithFileSchema(body);
}
/**
* PUT /fake/body-with-query-params
*
* @param query (required)
* @param body (required)
* @return Success (status code 200)
* @see FakeApi#testBodyWithQueryParams
*/
public ResponseEntity<Void> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User body) {
return delegate.testBodyWithQueryParams(query, body);
}
/**
* PATCH /fake : To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model
*
* @param body client model (required)
* @return successful operation (status code 200)
* @see FakeApi#testClientModel
*/
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
return delegate.testClientModel(body);
}
/**
* POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*
* @param number None (required)
* @param _double None (required)
* @param patternWithoutDelimiter None (required)
* @param _byte None (required)
* @param integer None (optional)
* @param int32 None (optional)
* @param int64 None (optional)
* @param _float None (optional)
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param password None (optional)
* @param paramCallback None (optional)
* @return Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see FakeApi#testEndpointParameters
*/
public ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "number", required = true) BigDecimal number,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "double", required = true) Double _double,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "pattern_without_delimiter", required = true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @Valid @RequestPart(value = "byte", required = true) byte[] _byte,@ApiParam(value = "None") @Valid @RequestPart(value = "integer", required = false) Integer integer,@ApiParam(value = "None") @Valid @RequestPart(value = "int32", required = false) Integer int32,@ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64,@ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float,@ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string,@ApiParam(value = "None") @Valid @RequestPart(value = "binary", required = false) MultipartFile binary,@ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) LocalDate date,@ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) OffsetDateTime dateTime,@ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password,@ApiParam(value = "None") @Valid @RequestPart(value = "callback", required = false) String paramCallback) {
return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
}
/**
* GET /fake : To test enum parameters
* To test enum parameters
*
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;())
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;())
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumFormStringArray Form parameter enum test (string array) (optional, default to $)
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @return Invalid request (status code 400)
* or Not found (status code 404)
* @see FakeApi#testEnumParameters
*/
public ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @Valid @RequestPart(value = "enum_form_string", required = false) String enumFormString) {
return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
}
/**
* DELETE /fake : Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
*
* @param requiredStringGroup Required String in group parameters (required)
* @param requiredBooleanGroup Required Boolean in group parameters (required)
* @param requiredInt64Group Required Integer in group parameters (required)
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @return Someting wrong (status code 400)
* @see FakeApi#testGroupParameters
*/
public ResponseEntity<Void> testGroupParameters(@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,@ApiParam(value = "Required Boolean in group parameters" ,required=true) @RequestHeader(value="required_boolean_group", required=true) Boolean requiredBooleanGroup,@NotNull @ApiParam(value = "Required Integer in group parameters", required = true) @Valid @RequestParam(value = "required_int64_group", required = true) Long requiredInt64Group,@ApiParam(value = "String in group parameters") @Valid @RequestParam(value = "string_group", required = false) Integer stringGroup,@ApiParam(value = "Boolean in group parameters" ) @RequestHeader(value="boolean_group", required=false) Boolean booleanGroup,@ApiParam(value = "Integer in group parameters") @Valid @RequestParam(value = "int64_group", required = false) Long int64Group) {
return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
}
/**
* POST /fake/inline-additionalProperties : test inline additionalProperties
*
* @param param request body (required)
* @return successful operation (status code 200)
* @see FakeApi#testInlineAdditionalProperties
*/
public ResponseEntity<Void> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map<String, String> param) {
return delegate.testInlineAdditionalProperties(param);
}
/**
* GET /fake/jsonFormData : test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @return successful operation (status code 200)
* @see FakeApi#testJsonFormData
*/
public ResponseEntity<Void> testJsonFormData(@ApiParam(value = "field1", required=true) @Valid @RequestPart(value = "param", required = true) String param,@ApiParam(value = "field2", required=true) @Valid @RequestPart(value = "param2", required = true) String param2) {
return delegate.testJsonFormData(param, param2);
}
/**
* PUT /fake/test-query-paramters
* To test the collection format in query parameters
*
* @param pipe (required)
* @param ioutil (required)
* @param http (required)
* @param url (required)
* @param context (required)
* @return Success (status code 200)
* @see FakeApi#testQueryParameterCollectionFormat
*/
public ResponseEntity<Void> testQueryParameterCollectionFormat(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "http", required = true) List<String> http,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "url", required = true) List<String> url,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "context", required = true) List<String> context) {
return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
}
/**
* POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @return successful operation (status code 200)
* @see FakeApi#uploadFileWithRequiredFile
*/
public ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata) {
return delegate.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
} }
} }

View File

@ -3,20 +3,24 @@ package org.openapitools.api;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import org.openapitools.model.FileSchemaTestClass; import org.openapitools.model.FileSchemaTestClass;
import org.threeten.bp.LocalDate; import java.time.LocalDate;
import java.util.Map; import java.util.Map;
import org.openapitools.model.ModelApiResponse; import org.openapitools.model.ModelApiResponse;
import org.threeten.bp.OffsetDateTime; import java.time.OffsetDateTime;
import org.openapitools.model.OuterComposite; import org.openapitools.model.OuterComposite;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.openapitools.model.User; import org.openapitools.model.User;
import org.openapitools.model.XmlItem; import org.openapitools.model.XmlItem;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* A delegate to be called by the {@link FakeApiController}}. * A delegate to be called by the {@link FakeApiController}}.
@ -25,6 +29,10 @@ import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface FakeApiDelegate { public interface FakeApiDelegate {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* POST /fake/create_xml_item : creates an XmlItem * POST /fake/create_xml_item : creates an XmlItem
* this route creates an XmlItem * this route creates an XmlItem
@ -33,7 +41,10 @@ public interface FakeApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see FakeApi#createXmlItem * @see FakeApi#createXmlItem
*/ */
ResponseEntity<Void> createXmlItem(XmlItem xmlItem); default ResponseEntity<Void> createXmlItem(XmlItem xmlItem) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake/outer/boolean * POST /fake/outer/boolean
@ -43,7 +54,10 @@ public interface FakeApiDelegate {
* @return Output boolean (status code 200) * @return Output boolean (status code 200)
* @see FakeApi#fakeOuterBooleanSerialize * @see FakeApi#fakeOuterBooleanSerialize
*/ */
ResponseEntity<Boolean> fakeOuterBooleanSerialize(Boolean body); default ResponseEntity<Boolean> fakeOuterBooleanSerialize(Boolean body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake/outer/composite * POST /fake/outer/composite
@ -53,7 +67,19 @@ public interface FakeApiDelegate {
* @return Output composite (status code 200) * @return Output composite (status code 200)
* @see FakeApi#fakeOuterCompositeSerialize * @see FakeApi#fakeOuterCompositeSerialize
*/ */
ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(OuterComposite body); default ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(OuterComposite body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
ApiUtil.setExampleResponse(request, "*/*", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake/outer/number * POST /fake/outer/number
@ -63,7 +89,10 @@ public interface FakeApiDelegate {
* @return Output number (status code 200) * @return Output number (status code 200)
* @see FakeApi#fakeOuterNumberSerialize * @see FakeApi#fakeOuterNumberSerialize
*/ */
ResponseEntity<BigDecimal> fakeOuterNumberSerialize(BigDecimal body); default ResponseEntity<BigDecimal> fakeOuterNumberSerialize(BigDecimal body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake/outer/string * POST /fake/outer/string
@ -73,7 +102,10 @@ public interface FakeApiDelegate {
* @return Output string (status code 200) * @return Output string (status code 200)
* @see FakeApi#fakeOuterStringSerialize * @see FakeApi#fakeOuterStringSerialize
*/ */
ResponseEntity<String> fakeOuterStringSerialize(String body); default ResponseEntity<String> fakeOuterStringSerialize(String body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* PUT /fake/body-with-file-schema * PUT /fake/body-with-file-schema
@ -83,7 +115,10 @@ public interface FakeApiDelegate {
* @return Success (status code 200) * @return Success (status code 200)
* @see FakeApi#testBodyWithFileSchema * @see FakeApi#testBodyWithFileSchema
*/ */
ResponseEntity<Void> testBodyWithFileSchema(FileSchemaTestClass body); default ResponseEntity<Void> testBodyWithFileSchema(FileSchemaTestClass body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* PUT /fake/body-with-query-params * PUT /fake/body-with-query-params
@ -93,8 +128,11 @@ public interface FakeApiDelegate {
* @return Success (status code 200) * @return Success (status code 200)
* @see FakeApi#testBodyWithQueryParams * @see FakeApi#testBodyWithQueryParams
*/ */
ResponseEntity<Void> testBodyWithQueryParams(String query, default ResponseEntity<Void> testBodyWithQueryParams(String query,
User body); User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* PATCH /fake : To test \&quot;client\&quot; model * PATCH /fake : To test \&quot;client\&quot; model
@ -104,7 +142,19 @@ public interface FakeApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see FakeApi#testClientModel * @see FakeApi#testClientModel
*/ */
ResponseEntity<Client> testClientModel(Client body); default ResponseEntity<Client> testClientModel(Client body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * POST /fake : Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@ -128,7 +178,7 @@ public interface FakeApiDelegate {
* or User not found (status code 404) * or User not found (status code 404)
* @see FakeApi#testEndpointParameters * @see FakeApi#testEndpointParameters
*/ */
ResponseEntity<Void> testEndpointParameters(BigDecimal number, default ResponseEntity<Void> testEndpointParameters(BigDecimal number,
Double _double, Double _double,
String patternWithoutDelimiter, String patternWithoutDelimiter,
byte[] _byte, byte[] _byte,
@ -141,15 +191,18 @@ public interface FakeApiDelegate {
LocalDate date, LocalDate date,
OffsetDateTime dateTime, OffsetDateTime dateTime,
String password, String password,
String paramCallback); String paramCallback) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /fake : To test enum parameters * GET /fake : To test enum parameters
* To test enum parameters * To test enum parameters
* *
* @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;()) * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList&lt;&gt;())
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;String&gt;()) * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList&lt;&gt;())
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional)
@ -159,14 +212,17 @@ public interface FakeApiDelegate {
* or Not found (status code 404) * or Not found (status code 404)
* @see FakeApi#testEnumParameters * @see FakeApi#testEnumParameters
*/ */
ResponseEntity<Void> testEnumParameters(List<String> enumHeaderStringArray, default ResponseEntity<Void> testEnumParameters(List<String> enumHeaderStringArray,
String enumHeaderString, String enumHeaderString,
List<String> enumQueryStringArray, List<String> enumQueryStringArray,
String enumQueryString, String enumQueryString,
Integer enumQueryInteger, Integer enumQueryInteger,
Double enumQueryDouble, Double enumQueryDouble,
List<String> enumFormStringArray, List<String> enumFormStringArray,
String enumFormString); String enumFormString) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* DELETE /fake : Fake endpoint to test group parameters (optional) * DELETE /fake : Fake endpoint to test group parameters (optional)
@ -181,12 +237,15 @@ public interface FakeApiDelegate {
* @return Someting wrong (status code 400) * @return Someting wrong (status code 400)
* @see FakeApi#testGroupParameters * @see FakeApi#testGroupParameters
*/ */
ResponseEntity<Void> testGroupParameters(Integer requiredStringGroup, default ResponseEntity<Void> testGroupParameters(Integer requiredStringGroup,
Boolean requiredBooleanGroup, Boolean requiredBooleanGroup,
Long requiredInt64Group, Long requiredInt64Group,
Integer stringGroup, Integer stringGroup,
Boolean booleanGroup, Boolean booleanGroup,
Long int64Group); Long int64Group) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake/inline-additionalProperties : test inline additionalProperties * POST /fake/inline-additionalProperties : test inline additionalProperties
@ -195,7 +254,10 @@ public interface FakeApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see FakeApi#testInlineAdditionalProperties * @see FakeApi#testInlineAdditionalProperties
*/ */
ResponseEntity<Void> testInlineAdditionalProperties(Map<String, String> param); default ResponseEntity<Void> testInlineAdditionalProperties(Map<String, String> param) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /fake/jsonFormData : test json serialization of form data * GET /fake/jsonFormData : test json serialization of form data
@ -205,8 +267,11 @@ public interface FakeApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see FakeApi#testJsonFormData * @see FakeApi#testJsonFormData
*/ */
ResponseEntity<Void> testJsonFormData(String param, default ResponseEntity<Void> testJsonFormData(String param,
String param2); String param2) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* PUT /fake/test-query-paramters * PUT /fake/test-query-paramters
@ -220,11 +285,14 @@ public interface FakeApiDelegate {
* @return Success (status code 200) * @return Success (status code 200)
* @see FakeApi#testQueryParameterCollectionFormat * @see FakeApi#testQueryParameterCollectionFormat
*/ */
ResponseEntity<Void> testQueryParameterCollectionFormat(List<String> pipe, default ResponseEntity<Void> testQueryParameterCollectionFormat(List<String> pipe,
List<String> ioutil, List<String> ioutil,
List<String> http, List<String> http,
List<String> url, List<String> url,
List<String> context); List<String> context) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required) * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required)
@ -235,8 +303,20 @@ public interface FakeApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see FakeApi#uploadFileWithRequiredFile * @see FakeApi#uploadFileWithRequiredFile
*/ */
ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(Long petId, default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(Long petId,
MultipartFile requiredFile, MultipartFile requiredFile,
String additionalMetadata); String additionalMetadata) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -21,6 +21,10 @@ import java.util.Map;
@Api(value = "fake_classname_test", description = "the fake_classname_test API") @Api(value = "fake_classname_test", description = "the fake_classname_test API")
public interface FakeClassnameTestApi { public interface FakeClassnameTestApi {
default FakeClassnameTestApiDelegate getDelegate() {
return new FakeClassnameTestApiDelegate() {};
}
/** /**
* PATCH /fake_classname_test : To test class name in snake case * PATCH /fake_classname_test : To test class name in snake case
* To test class name in snake case * To test class name in snake case
@ -38,6 +42,8 @@ public interface FakeClassnameTestApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" } consumes = { "application/json" }
) )
ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); default ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
return getDelegate().testClassname(body);
}
} }

View File

@ -1,24 +1,8 @@
package org.openapitools.api; package org.openapitools.api;
import org.openapitools.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue; import java.util.Optional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
@ -27,19 +11,12 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi {
private final FakeClassnameTestApiDelegate delegate; private final FakeClassnameTestApiDelegate delegate;
public FakeClassnameTestApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) FakeClassnameTestApiDelegate delegate) { public FakeClassnameTestApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) FakeClassnameTestApiDelegate delegate) {
this.delegate = delegate; this.delegate = Optional.ofNullable(delegate).orElse(new FakeClassnameTestApiDelegate() {});
} }
/** @Override
* PATCH /fake_classname_test : To test class name in snake case public FakeClassnameTestApiDelegate getDelegate() {
* To test class name in snake case return delegate;
*
* @param body client model (required)
* @return successful operation (status code 200)
* @see FakeClassnameTestApi#testClassname
*/
public ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
return delegate.testClassname(body);
} }
} }

View File

@ -2,11 +2,15 @@ package org.openapitools.api;
import org.openapitools.model.Client; import org.openapitools.model.Client;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* A delegate to be called by the {@link FakeClassnameTestApiController}}. * A delegate to be called by the {@link FakeClassnameTestApiController}}.
@ -15,6 +19,10 @@ import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface FakeClassnameTestApiDelegate { public interface FakeClassnameTestApiDelegate {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* PATCH /fake_classname_test : To test class name in snake case * PATCH /fake_classname_test : To test class name in snake case
* To test class name in snake case * To test class name in snake case
@ -23,6 +31,18 @@ public interface FakeClassnameTestApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see FakeClassnameTestApi#testClassname * @see FakeClassnameTestApi#testClassname
*/ */
ResponseEntity<Client> testClassname(Client body); default ResponseEntity<Client> testClassname(Client body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"client\" : \"client\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -24,6 +24,10 @@ import java.util.Map;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
default PetApiDelegate getDelegate() {
return new PetApiDelegate() {};
}
/** /**
* POST /pet : Add a new pet to the store * POST /pet : Add a new pet to the store
* *
@ -44,7 +48,9 @@ public interface PetApi {
value = "/pet", value = "/pet",
consumes = { "application/json", "application/xml" } consumes = { "application/json", "application/xml" }
) )
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); default ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return getDelegate().addPet(body);
}
/** /**
@ -67,7 +73,9 @@ public interface PetApi {
@DeleteMapping( @DeleteMapping(
value = "/pet/{petId}" value = "/pet/{petId}"
) )
ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); default ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
return getDelegate().deletePet(petId, apiKey);
}
/** /**
@ -91,7 +99,9 @@ public interface PetApi {
value = "/pet/findByStatus", value = "/pet/findByStatus",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<List<Pet>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status); default ResponseEntity<List<Pet>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status) {
return getDelegate().findPetsByStatus(status);
}
/** /**
@ -116,7 +126,9 @@ public interface PetApi {
value = "/pet/findByTags", value = "/pet/findByTags",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Set<Pet>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) Set<String> tags); default ResponseEntity<Set<Pet>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) Set<String> tags) {
return getDelegate().findPetsByTags(tags);
}
/** /**
@ -139,7 +151,9 @@ public interface PetApi {
value = "/pet/{petId}", value = "/pet/{petId}",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId); default ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) {
return getDelegate().getPetById(petId);
}
/** /**
@ -166,7 +180,9 @@ public interface PetApi {
value = "/pet", value = "/pet",
consumes = { "application/json", "application/xml" } consumes = { "application/json", "application/xml" }
) )
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); default ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return getDelegate().updatePet(body);
}
/** /**
@ -189,7 +205,9 @@ public interface PetApi {
value = "/pet/{petId}", value = "/pet/{petId}",
consumes = { "application/x-www-form-urlencoded" } consumes = { "application/x-www-form-urlencoded" }
) )
ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name,@ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status); default ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name,@ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status) {
return getDelegate().updatePetWithForm(petId, name, status);
}
/** /**
@ -213,6 +231,8 @@ public interface PetApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "multipart/form-data" } consumes = { "multipart/form-data" }
) )
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "file", required = false) MultipartFile file); default ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "file", required = false) MultipartFile file) {
return getDelegate().uploadFile(petId, additionalMetadata, file);
}
} }

View File

@ -1,27 +1,8 @@
package org.openapitools.api; package org.openapitools.api;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.Pet;
import org.springframework.core.io.Resource;
import java.util.Set;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue; import java.util.Optional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
@ -30,113 +11,12 @@ public class PetApiController implements PetApi {
private final PetApiDelegate delegate; private final PetApiDelegate delegate;
public PetApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) PetApiDelegate delegate) { public PetApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) PetApiDelegate delegate) {
this.delegate = delegate; this.delegate = Optional.ofNullable(delegate).orElse(new PetApiDelegate() {});
} }
/** @Override
* POST /pet : Add a new pet to the store public PetApiDelegate getDelegate() {
* return delegate;
* @param body Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid input (status code 405)
* @see PetApi#addPet
*/
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return delegate.addPet(body);
}
/**
* DELETE /pet/{petId} : Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @return successful operation (status code 200)
* or Invalid pet value (status code 400)
* @see PetApi#deletePet
*/
public ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
return delegate.deletePet(petId, apiKey);
}
/**
* GET /pet/findByStatus : Finds Pets by status
* Multiple status values can be provided with comma separated strings
*
* @param status Status values that need to be considered for filter (required)
* @return successful operation (status code 200)
* or Invalid status value (status code 400)
* @see PetApi#findPetsByStatus
*/
public ResponseEntity<List<Pet>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status) {
return delegate.findPetsByStatus(status);
}
/**
* GET /pet/findByTags : Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* @param tags Tags to filter by (required)
* @return successful operation (status code 200)
* or Invalid tag value (status code 400)
* @deprecated
* @see PetApi#findPetsByTags
*/
public ResponseEntity<Set<Pet>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) Set<String> tags) {
return delegate.findPetsByTags(tags);
}
/**
* GET /pet/{petId} : Find pet by ID
* Returns a single pet
*
* @param petId ID of pet to return (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
* @see PetApi#getPetById
*/
public ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) {
return delegate.getPetById(petId);
}
/**
* PUT /pet : Update an existing pet
*
* @param body Pet object that needs to be added to the store (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Pet not found (status code 404)
* or Validation exception (status code 405)
* @see PetApi#updatePet
*/
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
return delegate.updatePet(body);
}
/**
* POST /pet/{petId} : Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return Invalid input (status code 405)
* @see PetApi#updatePetWithForm
*/
public ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @Valid @RequestPart(value = "name", required = false) String name,@ApiParam(value = "Updated status of the pet") @Valid @RequestPart(value = "status", required = false) String status) {
return delegate.updatePetWithForm(petId, name, status);
}
/**
* POST /pet/{petId}/uploadImage : uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return successful operation (status code 200)
* @see PetApi#uploadFile
*/
public ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata,@ApiParam(value = "file to upload") @Valid @RequestPart(value = "file", required = false) MultipartFile file) {
return delegate.uploadFile(petId, additionalMetadata, file);
} }
} }

View File

@ -5,11 +5,15 @@ import org.openapitools.model.Pet;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import java.util.Set; import java.util.Set;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* A delegate to be called by the {@link PetApiController}}. * A delegate to be called by the {@link PetApiController}}.
@ -18,6 +22,10 @@ import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface PetApiDelegate { public interface PetApiDelegate {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* POST /pet : Add a new pet to the store * POST /pet : Add a new pet to the store
* *
@ -26,7 +34,10 @@ public interface PetApiDelegate {
* or Invalid input (status code 405) * or Invalid input (status code 405)
* @see PetApi#addPet * @see PetApi#addPet
*/ */
ResponseEntity<Void> addPet(Pet body); default ResponseEntity<Void> addPet(Pet body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* DELETE /pet/{petId} : Deletes a pet * DELETE /pet/{petId} : Deletes a pet
@ -37,8 +48,11 @@ public interface PetApiDelegate {
* or Invalid pet value (status code 400) * or Invalid pet value (status code 400)
* @see PetApi#deletePet * @see PetApi#deletePet
*/ */
ResponseEntity<Void> deletePet(Long petId, default ResponseEntity<Void> deletePet(Long petId,
String apiKey); String apiKey) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /pet/findByStatus : Finds Pets by status * GET /pet/findByStatus : Finds Pets by status
@ -49,7 +63,24 @@ public interface PetApiDelegate {
* or Invalid status value (status code 400) * or Invalid status value (status code 400)
* @see PetApi#findPetsByStatus * @see PetApi#findPetsByStatus
*/ */
ResponseEntity<List<Pet>> findPetsByStatus(List<String> status); default ResponseEntity<List<Pet>> findPetsByStatus(List<String> status) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /pet/findByTags : Finds Pets by tags * GET /pet/findByTags : Finds Pets by tags
@ -61,7 +92,24 @@ public interface PetApiDelegate {
* @deprecated * @deprecated
* @see PetApi#findPetsByTags * @see PetApi#findPetsByTags
*/ */
ResponseEntity<Set<Pet>> findPetsByTags(Set<String> tags); default ResponseEntity<Set<Pet>> findPetsByTags(Set<String> tags) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /pet/{petId} : Find pet by ID * GET /pet/{petId} : Find pet by ID
@ -73,7 +121,24 @@ public interface PetApiDelegate {
* or Pet not found (status code 404) * or Pet not found (status code 404)
* @see PetApi#getPetById * @see PetApi#getPetById
*/ */
ResponseEntity<Pet> getPetById(Long petId); default ResponseEntity<Pet> getPetById(Long petId) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* PUT /pet : Update an existing pet * PUT /pet : Update an existing pet
@ -85,7 +150,10 @@ public interface PetApiDelegate {
* or Validation exception (status code 405) * or Validation exception (status code 405)
* @see PetApi#updatePet * @see PetApi#updatePet
*/ */
ResponseEntity<Void> updatePet(Pet body); default ResponseEntity<Void> updatePet(Pet body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /pet/{petId} : Updates a pet in the store with form data * POST /pet/{petId} : Updates a pet in the store with form data
@ -96,9 +164,12 @@ public interface PetApiDelegate {
* @return Invalid input (status code 405) * @return Invalid input (status code 405)
* @see PetApi#updatePetWithForm * @see PetApi#updatePetWithForm
*/ */
ResponseEntity<Void> updatePetWithForm(Long petId, default ResponseEntity<Void> updatePetWithForm(Long petId,
String name, String name,
String status); String status) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /pet/{petId}/uploadImage : uploads an image * POST /pet/{petId}/uploadImage : uploads an image
@ -109,8 +180,20 @@ public interface PetApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see PetApi#uploadFile * @see PetApi#uploadFile
*/ */
ResponseEntity<ModelApiResponse> uploadFile(Long petId, default ResponseEntity<ModelApiResponse> uploadFile(Long petId,
String additionalMetadata, String additionalMetadata,
MultipartFile file); MultipartFile file) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -22,6 +22,10 @@ import java.util.Map;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
default StoreApiDelegate getDelegate() {
return new StoreApiDelegate() {};
}
/** /**
* DELETE /store/order/{order_id} : Delete purchase order by ID * DELETE /store/order/{order_id} : Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@ -37,7 +41,9 @@ public interface StoreApi {
@DeleteMapping( @DeleteMapping(
value = "/store/order/{order_id}" value = "/store/order/{order_id}"
) )
ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId); default ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) {
return getDelegate().deleteOrder(orderId);
}
/** /**
@ -55,7 +61,9 @@ public interface StoreApi {
value = "/store/inventory", value = "/store/inventory",
produces = { "application/json" } produces = { "application/json" }
) )
ResponseEntity<Map<String, Integer>> getInventory(); default ResponseEntity<Map<String, Integer>> getInventory() {
return getDelegate().getInventory();
}
/** /**
@ -76,7 +84,9 @@ public interface StoreApi {
value = "/store/order/{order_id}", value = "/store/order/{order_id}",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Order> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId); default ResponseEntity<Order> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) {
return getDelegate().getOrderById(orderId);
}
/** /**
@ -94,6 +104,8 @@ public interface StoreApi {
value = "/store/order", value = "/store/order",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); default ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
return getDelegate().placeOrder(body);
}
} }

View File

@ -1,25 +1,8 @@
package org.openapitools.api; package org.openapitools.api;
import java.util.Map;
import org.openapitools.model.Order;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue; import java.util.Optional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
@ -28,57 +11,12 @@ public class StoreApiController implements StoreApi {
private final StoreApiDelegate delegate; private final StoreApiDelegate delegate;
public StoreApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) StoreApiDelegate delegate) { public StoreApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) StoreApiDelegate delegate) {
this.delegate = delegate; this.delegate = Optional.ofNullable(delegate).orElse(new StoreApiDelegate() {});
} }
/** @Override
* DELETE /store/order/{order_id} : Delete purchase order by ID public StoreApiDelegate getDelegate() {
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors return delegate;
*
* @param orderId ID of the order that needs to be deleted (required)
* @return Invalid ID supplied (status code 400)
* or Order not found (status code 404)
* @see StoreApi#deleteOrder
*/
public ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId) {
return delegate.deleteOrder(orderId);
}
/**
* GET /store/inventory : Returns pet inventories by status
* Returns a map of status codes to quantities
*
* @return successful operation (status code 200)
* @see StoreApi#getInventory
*/
public ResponseEntity<Map<String, Integer>> getInventory() {
return delegate.getInventory();
}
/**
* GET /store/order/{order_id} : Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
*
* @param orderId ID of pet that needs to be fetched (required)
* @return successful operation (status code 200)
* or Invalid ID supplied (status code 400)
* or Order not found (status code 404)
* @see StoreApi#getOrderById
*/
public ResponseEntity<Order> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) {
return delegate.getOrderById(orderId);
}
/**
* POST /store/order : Place an order for a pet
*
* @param body order placed for purchasing the pet (required)
* @return successful operation (status code 200)
* or Invalid Order (status code 400)
* @see StoreApi#placeOrder
*/
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
return delegate.placeOrder(body);
} }
} }

View File

@ -3,11 +3,15 @@ package org.openapitools.api;
import java.util.Map; import java.util.Map;
import org.openapitools.model.Order; import org.openapitools.model.Order;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* A delegate to be called by the {@link StoreApiController}}. * A delegate to be called by the {@link StoreApiController}}.
@ -16,6 +20,10 @@ import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface StoreApiDelegate { public interface StoreApiDelegate {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* DELETE /store/order/{order_id} : Delete purchase order by ID * DELETE /store/order/{order_id} : Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
@ -25,7 +33,10 @@ public interface StoreApiDelegate {
* or Order not found (status code 404) * or Order not found (status code 404)
* @see StoreApi#deleteOrder * @see StoreApi#deleteOrder
*/ */
ResponseEntity<Void> deleteOrder(String orderId); default ResponseEntity<Void> deleteOrder(String orderId) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /store/inventory : Returns pet inventories by status * GET /store/inventory : Returns pet inventories by status
@ -34,7 +45,10 @@ public interface StoreApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see StoreApi#getInventory * @see StoreApi#getInventory
*/ */
ResponseEntity<Map<String, Integer>> getInventory(); default ResponseEntity<Map<String, Integer>> getInventory() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /store/order/{order_id} : Find purchase order by ID * GET /store/order/{order_id} : Find purchase order by ID
@ -46,7 +60,24 @@ public interface StoreApiDelegate {
* or Order not found (status code 404) * or Order not found (status code 404)
* @see StoreApi#getOrderById * @see StoreApi#getOrderById
*/ */
ResponseEntity<Order> getOrderById(Long orderId); default ResponseEntity<Order> getOrderById(Long orderId) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /store/order : Place an order for a pet * POST /store/order : Place an order for a pet
@ -56,6 +87,23 @@ public interface StoreApiDelegate {
* or Invalid Order (status code 400) * or Invalid Order (status code 400)
* @see StoreApi#placeOrder * @see StoreApi#placeOrder
*/ */
ResponseEntity<Order> placeOrder(Order body); default ResponseEntity<Order> placeOrder(Order body) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -22,6 +22,10 @@ import java.util.Map;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
default UserApiDelegate getDelegate() {
return new UserApiDelegate() {};
}
/** /**
* POST /user : Create user * POST /user : Create user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -35,7 +39,9 @@ public interface UserApi {
@PostMapping( @PostMapping(
value = "/user" value = "/user"
) )
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); default ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
return getDelegate().createUser(body);
}
/** /**
@ -50,7 +56,9 @@ public interface UserApi {
@PostMapping( @PostMapping(
value = "/user/createWithArray" value = "/user/createWithArray"
) )
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body); default ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return getDelegate().createUsersWithArrayInput(body);
}
/** /**
@ -65,7 +73,9 @@ public interface UserApi {
@PostMapping( @PostMapping(
value = "/user/createWithList" value = "/user/createWithList"
) )
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body); default ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return getDelegate().createUsersWithListInput(body);
}
/** /**
@ -83,7 +93,9 @@ public interface UserApi {
@DeleteMapping( @DeleteMapping(
value = "/user/{username}" value = "/user/{username}"
) )
ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username); default ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) {
return getDelegate().deleteUser(username);
}
/** /**
@ -103,7 +115,9 @@ public interface UserApi {
value = "/user/{username}", value = "/user/{username}",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username); default ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) {
return getDelegate().getUserByName(username);
}
/** /**
@ -122,7 +136,9 @@ public interface UserApi {
value = "/user/login", value = "/user/login",
produces = { "application/xml", "application/json" } produces = { "application/xml", "application/json" }
) )
ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password); default ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) {
return getDelegate().loginUser(username, password);
}
/** /**
@ -136,7 +152,9 @@ public interface UserApi {
@GetMapping( @GetMapping(
value = "/user/logout" value = "/user/logout"
) )
ResponseEntity<Void> logoutUser(); default ResponseEntity<Void> logoutUser() {
return getDelegate().logoutUser();
}
/** /**
@ -155,6 +173,8 @@ public interface UserApi {
@PutMapping( @PutMapping(
value = "/user/{username}" value = "/user/{username}"
) )
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); default ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
return getDelegate().updateUser(username, body);
}
} }

View File

@ -1,25 +1,8 @@
package org.openapitools.api; package org.openapitools.api;
import java.util.List;
import org.openapitools.model.User;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.CookieValue; import java.util.Optional;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller @Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
@ -28,104 +11,12 @@ public class UserApiController implements UserApi {
private final UserApiDelegate delegate; private final UserApiDelegate delegate;
public UserApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) UserApiDelegate delegate) { public UserApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) UserApiDelegate delegate) {
this.delegate = delegate; this.delegate = Optional.ofNullable(delegate).orElse(new UserApiDelegate() {});
} }
/** @Override
* POST /user : Create user public UserApiDelegate getDelegate() {
* This can only be done by the logged in user. return delegate;
*
* @param body Created user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUser
*/
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
return delegate.createUser(body);
}
/**
* POST /user/createWithArray : Creates list of users with given input array
*
* @param body List of user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUsersWithArrayInput
*/
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return delegate.createUsersWithArrayInput(body);
}
/**
* POST /user/createWithList : Creates list of users with given input array
*
* @param body List of user object (required)
* @return successful operation (status code 200)
* @see UserApi#createUsersWithListInput
*/
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
return delegate.createUsersWithListInput(body);
}
/**
* DELETE /user/{username} : Delete user
* This can only be done by the logged in user.
*
* @param username The name that needs to be deleted (required)
* @return Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#deleteUser
*/
public ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) {
return delegate.deleteUser(username);
}
/**
* GET /user/{username} : Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return successful operation (status code 200)
* or Invalid username supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#getUserByName
*/
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) {
return delegate.getUserByName(username);
}
/**
* GET /user/login : Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return successful operation (status code 200)
* or Invalid username/password supplied (status code 400)
* @see UserApi#loginUser
*/
public ResponseEntity<String> loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password) {
return delegate.loginUser(username, password);
}
/**
* GET /user/logout : Logs out current logged in user session
*
* @return successful operation (status code 200)
* @see UserApi#logoutUser
*/
public ResponseEntity<Void> logoutUser() {
return delegate.logoutUser();
}
/**
* PUT /user/{username} : Updated user
* This can only be done by the logged in user.
*
* @param username name that need to be deleted (required)
* @param body Updated user object (required)
* @return Invalid user supplied (status code 400)
* or User not found (status code 404)
* @see UserApi#updateUser
*/
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
return delegate.updateUser(username, body);
} }
} }

View File

@ -3,11 +3,15 @@ package org.openapitools.api;
import java.util.List; import java.util.List;
import org.openapitools.model.User; import org.openapitools.model.User;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* A delegate to be called by the {@link UserApiController}}. * A delegate to be called by the {@link UserApiController}}.
@ -16,6 +20,10 @@ import java.util.Map;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface UserApiDelegate { public interface UserApiDelegate {
default Optional<NativeWebRequest> getRequest() {
return Optional.empty();
}
/** /**
* POST /user : Create user * POST /user : Create user
* This can only be done by the logged in user. * This can only be done by the logged in user.
@ -24,7 +32,10 @@ public interface UserApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see UserApi#createUser * @see UserApi#createUser
*/ */
ResponseEntity<Void> createUser(User body); default ResponseEntity<Void> createUser(User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /user/createWithArray : Creates list of users with given input array * POST /user/createWithArray : Creates list of users with given input array
@ -33,7 +44,10 @@ public interface UserApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see UserApi#createUsersWithArrayInput * @see UserApi#createUsersWithArrayInput
*/ */
ResponseEntity<Void> createUsersWithArrayInput(List<User> body); default ResponseEntity<Void> createUsersWithArrayInput(List<User> body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* POST /user/createWithList : Creates list of users with given input array * POST /user/createWithList : Creates list of users with given input array
@ -42,7 +56,10 @@ public interface UserApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see UserApi#createUsersWithListInput * @see UserApi#createUsersWithListInput
*/ */
ResponseEntity<Void> createUsersWithListInput(List<User> body); default ResponseEntity<Void> createUsersWithListInput(List<User> body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* DELETE /user/{username} : Delete user * DELETE /user/{username} : Delete user
@ -53,7 +70,10 @@ public interface UserApiDelegate {
* or User not found (status code 404) * or User not found (status code 404)
* @see UserApi#deleteUser * @see UserApi#deleteUser
*/ */
ResponseEntity<Void> deleteUser(String username); default ResponseEntity<Void> deleteUser(String username) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /user/{username} : Get user by user name * GET /user/{username} : Get user by user name
@ -64,7 +84,24 @@ public interface UserApiDelegate {
* or User not found (status code 404) * or User not found (status code 404)
* @see UserApi#getUserByName * @see UserApi#getUserByName
*/ */
ResponseEntity<User> getUserByName(String username); default ResponseEntity<User> getUserByName(String username) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<User> <id>123456789</id> <username>aeiou</username> <firstName>aeiou</firstName> <lastName>aeiou</lastName> <email>aeiou</email> <password>aeiou</password> <phone>aeiou</phone> <userStatus>123</userStatus> </User>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
}
});
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /user/login : Logs user into the system * GET /user/login : Logs user into the system
@ -75,8 +112,11 @@ public interface UserApiDelegate {
* or Invalid username/password supplied (status code 400) * or Invalid username/password supplied (status code 400)
* @see UserApi#loginUser * @see UserApi#loginUser
*/ */
ResponseEntity<String> loginUser(String username, default ResponseEntity<String> loginUser(String username,
String password); String password) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* GET /user/logout : Logs out current logged in user session * GET /user/logout : Logs out current logged in user session
@ -84,7 +124,10 @@ public interface UserApiDelegate {
* @return successful operation (status code 200) * @return successful operation (status code 200)
* @see UserApi#logoutUser * @see UserApi#logoutUser
*/ */
ResponseEntity<Void> logoutUser(); default ResponseEntity<Void> logoutUser() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
/** /**
* PUT /user/{username} : Updated user * PUT /user/{username} : Updated user
@ -96,7 +139,10 @@ public interface UserApiDelegate {
* or User not found (status code 404) * or User not found (status code 404)
* @see UserApi#updateUser * @see UserApi#updateUser
*/ */
ResponseEntity<Void> updateUser(String username, default ResponseEntity<Void> updateUser(String username,
User body); User body) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
} }

View File

@ -1,232 +0,0 @@
package org.openapitools.configuration;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonTokenId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils;
import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase;
import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction;
import com.fasterxml.jackson.datatype.threetenbp.function.Function;
import org.threeten.bp.DateTimeException;
import org.threeten.bp.DateTimeUtils;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZonedDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.temporal.Temporal;
import org.threeten.bp.temporal.TemporalAccessor;
import java.io.IOException;
import java.math.BigDecimal;
/**
* Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s.
* Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format.
*
* @author Nick Williams
*/
public class CustomInstantDeserializer<T extends Temporal>
extends ThreeTenDateTimeDeserializerBase<T> {
private static final long serialVersionUID = 1L;
public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>(
Instant.class, DateTimeFormatter.ISO_INSTANT,
new Function<TemporalAccessor, Instant>() {
@Override
public Instant apply(TemporalAccessor temporalAccessor) {
return Instant.from(temporalAccessor);
}
},
new Function<FromIntegerArguments, Instant>() {
@Override
public Instant apply(FromIntegerArguments a) {
return Instant.ofEpochMilli(a.value);
}
},
new Function<FromDecimalArguments, Instant>() {
@Override
public Instant apply(FromDecimalArguments a) {
return Instant.ofEpochSecond(a.integer, a.fraction);
}
},
null
);
public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>(
OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME,
new Function<TemporalAccessor, OffsetDateTime>() {
@Override
public OffsetDateTime apply(TemporalAccessor temporalAccessor) {
return OffsetDateTime.from(temporalAccessor);
}
},
new Function<FromIntegerArguments, OffsetDateTime>() {
@Override
public OffsetDateTime apply(FromIntegerArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
new Function<FromDecimalArguments, OffsetDateTime>() {
@Override
public OffsetDateTime apply(FromDecimalArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() {
@Override
public OffsetDateTime apply(OffsetDateTime d, ZoneId z) {
return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()));
}
}
);
public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>(
ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME,
new Function<TemporalAccessor, ZonedDateTime>() {
@Override
public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
return ZonedDateTime.from(temporalAccessor);
}
},
new Function<FromIntegerArguments, ZonedDateTime>() {
@Override
public ZonedDateTime apply(FromIntegerArguments a) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
new Function<FromDecimalArguments, ZonedDateTime>() {
@Override
public ZonedDateTime apply(FromDecimalArguments a) {
return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() {
@Override
public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) {
return zonedDateTime.withZoneSameInstant(zoneId);
}
}
);
protected final Function<FromIntegerArguments, T> fromMilliseconds;
protected final Function<FromDecimalArguments, T> fromNanoseconds;
protected final Function<TemporalAccessor, T> parsedToValue;
protected final BiFunction<T, ZoneId, T> adjust;
protected CustomInstantDeserializer(Class<T> supportedType,
DateTimeFormatter parser,
Function<TemporalAccessor, T> parsedToValue,
Function<FromIntegerArguments, T> fromMilliseconds,
Function<FromDecimalArguments, T> fromNanoseconds,
BiFunction<T, ZoneId, T> adjust) {
super(supportedType, parser);
this.parsedToValue = parsedToValue;
this.fromMilliseconds = fromMilliseconds;
this.fromNanoseconds = fromNanoseconds;
this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() {
@Override
public T apply(T t, ZoneId zoneId) {
return t;
}
} : adjust;
}
@SuppressWarnings("unchecked")
protected CustomInstantDeserializer(CustomInstantDeserializer<T> base, DateTimeFormatter f) {
super((Class<T>) base.handledType(), f);
parsedToValue = base.parsedToValue;
fromMilliseconds = base.fromMilliseconds;
fromNanoseconds = base.fromNanoseconds;
adjust = base.adjust;
}
@Override
protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) {
if (dtf == _formatter) {
return this;
}
return new CustomInstantDeserializer<T>(this, dtf);
}
@Override
public T deserialize(JsonParser parser, DeserializationContext context) throws IOException {
//NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only
//string values have to be adjusted to the configured TZ.
switch (parser.getCurrentTokenId()) {
case JsonTokenId.ID_NUMBER_FLOAT: {
BigDecimal value = parser.getDecimalValue();
long seconds = value.longValue();
int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds);
return fromNanoseconds.apply(new FromDecimalArguments(
seconds, nanoseconds, getZone(context)));
}
case JsonTokenId.ID_NUMBER_INT: {
long timestamp = parser.getLongValue();
if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) {
return this.fromNanoseconds.apply(new FromDecimalArguments(
timestamp, 0, this.getZone(context)
));
}
return this.fromMilliseconds.apply(new FromIntegerArguments(
timestamp, this.getZone(context)
));
}
case JsonTokenId.ID_STRING: {
String string = parser.getText().trim();
if (string.length() == 0) {
return null;
}
if (string.endsWith("+0000")) {
string = string.substring(0, string.length() - 5) + "Z";
}
T value;
try {
TemporalAccessor acc = _formatter.parse(string);
value = parsedToValue.apply(acc);
if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) {
return adjust.apply(value, this.getZone(context));
}
} catch (DateTimeException e) {
throw _peelDTE(e);
}
return value;
}
}
throw context.mappingException("Expected type float, integer, or string.");
}
private ZoneId getZone(DeserializationContext context) {
// Instants are always in UTC, so don't waste compute cycles
return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone());
}
private static class FromIntegerArguments {
public final long value;
public final ZoneId zoneId;
private FromIntegerArguments(long value, ZoneId zoneId) {
this.value = value;
this.zoneId = zoneId;
}
}
private static class FromDecimalArguments {
public final long integer;
public final int fraction;
public final ZoneId zoneId;
private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) {
this.integer = integer;
this.fraction = fraction;
this.zoneId = zoneId;
}
}
}

View File

@ -1,23 +0,0 @@
package org.openapitools.configuration;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZonedDateTime;
@Configuration
public class JacksonConfiguration {
@Bean
@ConditionalOnMissingBean(ThreeTenModule.class)
ThreeTenModule threeTenModule() {
ThreeTenModule module = new ThreeTenModule();
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
return module;
}
}

View File

@ -40,8 +40,9 @@ public class OpenAPIDocumentationConfig {
.select() .select()
.apis(RequestHandlerSelectors.basePackage("org.openapitools.api")) .apis(RequestHandlerSelectors.basePackage("org.openapitools.api"))
.build() .build()
.directModelSubstitute(org.threeten.bp.LocalDate.class, java.sql.Date.class) .pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath))
.directModelSubstitute(org.threeten.bp.OffsetDateTime.class, java.util.Date.class) .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
.apiInfo(apiInfo()); .apiInfo(apiInfo());
} }

View File

@ -66,7 +66,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) {
if (this.mapString == null) { if (this.mapString == null) {
this.mapString = new HashMap<String, String>(); this.mapString = new HashMap<>();
} }
this.mapString.put(key, mapStringItem); this.mapString.put(key, mapStringItem);
return this; return this;
@ -94,7 +94,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) {
if (this.mapNumber == null) { if (this.mapNumber == null) {
this.mapNumber = new HashMap<String, BigDecimal>(); this.mapNumber = new HashMap<>();
} }
this.mapNumber.put(key, mapNumberItem); this.mapNumber.put(key, mapNumberItem);
return this; return this;
@ -123,7 +123,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) {
if (this.mapInteger == null) { if (this.mapInteger == null) {
this.mapInteger = new HashMap<String, Integer>(); this.mapInteger = new HashMap<>();
} }
this.mapInteger.put(key, mapIntegerItem); this.mapInteger.put(key, mapIntegerItem);
return this; return this;
@ -151,7 +151,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) {
if (this.mapBoolean == null) { if (this.mapBoolean == null) {
this.mapBoolean = new HashMap<String, Boolean>(); this.mapBoolean = new HashMap<>();
} }
this.mapBoolean.put(key, mapBooleanItem); this.mapBoolean.put(key, mapBooleanItem);
return this; return this;
@ -179,7 +179,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) { public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) {
if (this.mapArrayInteger == null) { if (this.mapArrayInteger == null) {
this.mapArrayInteger = new HashMap<String, List<Integer>>(); this.mapArrayInteger = new HashMap<>();
} }
this.mapArrayInteger.put(key, mapArrayIntegerItem); this.mapArrayInteger.put(key, mapArrayIntegerItem);
return this; return this;
@ -208,7 +208,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) { public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) {
if (this.mapArrayAnytype == null) { if (this.mapArrayAnytype == null) {
this.mapArrayAnytype = new HashMap<String, List<Object>>(); this.mapArrayAnytype = new HashMap<>();
} }
this.mapArrayAnytype.put(key, mapArrayAnytypeItem); this.mapArrayAnytype.put(key, mapArrayAnytypeItem);
return this; return this;
@ -237,7 +237,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) { public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) {
if (this.mapMapString == null) { if (this.mapMapString == null) {
this.mapMapString = new HashMap<String, Map<String, String>>(); this.mapMapString = new HashMap<>();
} }
this.mapMapString.put(key, mapMapStringItem); this.mapMapString.put(key, mapMapStringItem);
return this; return this;
@ -266,7 +266,7 @@ public class AdditionalPropertiesClass {
public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) { public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) {
if (this.mapMapAnytype == null) { if (this.mapMapAnytype == null) {
this.mapMapAnytype = new HashMap<String, Map<String, Object>>(); this.mapMapAnytype = new HashMap<>();
} }
this.mapMapAnytype.put(key, mapMapAnytypeItem); this.mapMapAnytype.put(key, mapMapAnytypeItem);
return this; return this;

View File

@ -28,7 +28,7 @@ public class ArrayOfArrayOfNumberOnly {
public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) { public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) { if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>(); this.arrayArrayNumber = new ArrayList<>();
} }
this.arrayArrayNumber.add(arrayArrayNumberItem); this.arrayArrayNumber.add(arrayArrayNumberItem);
return this; return this;

View File

@ -28,7 +28,7 @@ public class ArrayOfNumberOnly {
public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) { if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<BigDecimal>(); this.arrayNumber = new ArrayList<>();
} }
this.arrayNumber.add(arrayNumberItem); this.arrayNumber.add(arrayNumberItem);
return this; return this;

View File

@ -36,7 +36,7 @@ public class ArrayTest {
public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
if (this.arrayOfString == null) { if (this.arrayOfString == null) {
this.arrayOfString = new ArrayList<String>(); this.arrayOfString = new ArrayList<>();
} }
this.arrayOfString.add(arrayOfStringItem); this.arrayOfString.add(arrayOfStringItem);
return this; return this;
@ -64,7 +64,7 @@ public class ArrayTest {
public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) { public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
if (this.arrayArrayOfInteger == null) { if (this.arrayArrayOfInteger == null) {
this.arrayArrayOfInteger = new ArrayList<List<Long>>(); this.arrayArrayOfInteger = new ArrayList<>();
} }
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this; return this;
@ -93,7 +93,7 @@ public class ArrayTest {
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) { public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) { if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>(); this.arrayArrayOfModel = new ArrayList<>();
} }
this.arrayArrayOfModel.add(arrayArrayOfModelItem); this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this; return this;

View File

@ -121,7 +121,7 @@ public class EnumArrays {
public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) {
if (this.arrayEnum == null) { if (this.arrayEnum == null) {
this.arrayEnum = new ArrayList<ArrayEnumEnum>(); this.arrayEnum = new ArrayList<>();
} }
this.arrayEnum.add(arrayEnumItem); this.arrayEnum.add(arrayEnumItem);
return this; return this;

View File

@ -51,7 +51,7 @@ public class FileSchemaTestClass {
public FileSchemaTestClass addFilesItem(java.io.File filesItem) { public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
if (this.files == null) { if (this.files == null) {
this.files = new ArrayList<java.io.File>(); this.files = new ArrayList<>();
} }
this.files.add(filesItem); this.files.add(filesItem);
return this; return this;

View File

@ -6,10 +6,10 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.UUID; import java.util.UUID;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;

View File

@ -76,7 +76,7 @@ public class MapTest {
public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) { public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
if (this.mapMapOfString == null) { if (this.mapMapOfString == null) {
this.mapMapOfString = new HashMap<String, Map<String, String>>(); this.mapMapOfString = new HashMap<>();
} }
this.mapMapOfString.put(key, mapMapOfStringItem); this.mapMapOfString.put(key, mapMapOfStringItem);
return this; return this;
@ -105,7 +105,7 @@ public class MapTest {
public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
if (this.mapOfEnumString == null) { if (this.mapOfEnumString == null) {
this.mapOfEnumString = new HashMap<String, InnerEnum>(); this.mapOfEnumString = new HashMap<>();
} }
this.mapOfEnumString.put(key, mapOfEnumStringItem); this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this; return this;
@ -133,7 +133,7 @@ public class MapTest {
public MapTest putDirectMapItem(String key, Boolean directMapItem) { public MapTest putDirectMapItem(String key, Boolean directMapItem) {
if (this.directMap == null) { if (this.directMap == null) {
this.directMap = new HashMap<String, Boolean>(); this.directMap = new HashMap<>();
} }
this.directMap.put(key, directMapItem); this.directMap.put(key, directMapItem);
return this; return this;
@ -161,7 +161,7 @@ public class MapTest {
public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) {
if (this.indirectMap == null) { if (this.indirectMap == null) {
this.indirectMap = new HashMap<String, Boolean>(); this.indirectMap = new HashMap<>();
} }
this.indirectMap.put(key, indirectMapItem); this.indirectMap.put(key, indirectMapItem);
return this; return this;

View File

@ -5,12 +5,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.time.OffsetDateTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.openapitools.model.Animal; import org.openapitools.model.Animal;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@ -80,7 +80,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
if (this.map == null) { if (this.map == null) {
this.map = new HashMap<String, Animal>(); this.map = new HashMap<>();
} }
this.map.put(key, mapItem); this.map.put(key, mapItem);
return this; return this;

View File

@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.threeten.bp.OffsetDateTime; import java.time.OffsetDateTime;
import org.openapitools.jackson.nullable.JsonNullable; import org.openapitools.jackson.nullable.JsonNullable;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.*; import javax.validation.constraints.*;

View File

@ -32,7 +32,7 @@ public class Pet {
@JsonProperty("photoUrls") @JsonProperty("photoUrls")
@Valid @Valid
private Set<String> photoUrls = new LinkedHashSet<String>(); private Set<String> photoUrls = new LinkedHashSet<>();
@JsonProperty("tags") @JsonProperty("tags")
@Valid @Valid
@ -173,7 +173,7 @@ public class Pet {
public Pet addTagsItem(Tag tagsItem) { public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) { if (this.tags == null) {
this.tags = new ArrayList<Tag>(); this.tags = new ArrayList<>();
} }
this.tags.add(tagsItem); this.tags.add(tagsItem);
return this; return this;

View File

@ -31,7 +31,7 @@ public class TypeHolderDefault {
@JsonProperty("array_item") @JsonProperty("array_item")
@Valid @Valid
private List<Integer> arrayItem = new ArrayList<Integer>(); private List<Integer> arrayItem = new ArrayList<>();
public TypeHolderDefault stringItem(String stringItem) { public TypeHolderDefault stringItem(String stringItem) {
this.stringItem = stringItem; this.stringItem = stringItem;

View File

@ -34,7 +34,7 @@ public class TypeHolderExample {
@JsonProperty("array_item") @JsonProperty("array_item")
@Valid @Valid
private List<Integer> arrayItem = new ArrayList<Integer>(); private List<Integer> arrayItem = new ArrayList<>();
public TypeHolderExample stringItem(String stringItem) { public TypeHolderExample stringItem(String stringItem) {
this.stringItem = stringItem; this.stringItem = stringItem;

View File

@ -201,7 +201,7 @@ public class XmlItem {
public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) {
if (this.wrappedArray == null) { if (this.wrappedArray == null) {
this.wrappedArray = new ArrayList<Integer>(); this.wrappedArray = new ArrayList<>();
} }
this.wrappedArray.add(wrappedArrayItem); this.wrappedArray.add(wrappedArrayItem);
return this; return this;
@ -310,7 +310,7 @@ public class XmlItem {
public XmlItem addNameArrayItem(Integer nameArrayItem) { public XmlItem addNameArrayItem(Integer nameArrayItem) {
if (this.nameArray == null) { if (this.nameArray == null) {
this.nameArray = new ArrayList<Integer>(); this.nameArray = new ArrayList<>();
} }
this.nameArray.add(nameArrayItem); this.nameArray.add(nameArrayItem);
return this; return this;
@ -338,7 +338,7 @@ public class XmlItem {
public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) {
if (this.nameWrappedArray == null) { if (this.nameWrappedArray == null) {
this.nameWrappedArray = new ArrayList<Integer>(); this.nameWrappedArray = new ArrayList<>();
} }
this.nameWrappedArray.add(nameWrappedArrayItem); this.nameWrappedArray.add(nameWrappedArrayItem);
return this; return this;
@ -447,7 +447,7 @@ public class XmlItem {
public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { public XmlItem addPrefixArrayItem(Integer prefixArrayItem) {
if (this.prefixArray == null) { if (this.prefixArray == null) {
this.prefixArray = new ArrayList<Integer>(); this.prefixArray = new ArrayList<>();
} }
this.prefixArray.add(prefixArrayItem); this.prefixArray.add(prefixArrayItem);
return this; return this;
@ -475,7 +475,7 @@ public class XmlItem {
public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) {
if (this.prefixWrappedArray == null) { if (this.prefixWrappedArray == null) {
this.prefixWrappedArray = new ArrayList<Integer>(); this.prefixWrappedArray = new ArrayList<>();
} }
this.prefixWrappedArray.add(prefixWrappedArrayItem); this.prefixWrappedArray.add(prefixWrappedArrayItem);
return this; return this;
@ -584,7 +584,7 @@ public class XmlItem {
public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) {
if (this.namespaceArray == null) { if (this.namespaceArray == null) {
this.namespaceArray = new ArrayList<Integer>(); this.namespaceArray = new ArrayList<>();
} }
this.namespaceArray.add(namespaceArrayItem); this.namespaceArray.add(namespaceArrayItem);
return this; return this;
@ -612,7 +612,7 @@ public class XmlItem {
public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) {
if (this.namespaceWrappedArray == null) { if (this.namespaceWrappedArray == null) {
this.namespaceWrappedArray = new ArrayList<Integer>(); this.namespaceWrappedArray = new ArrayList<>();
} }
this.namespaceWrappedArray.add(namespaceWrappedArrayItem); this.namespaceWrappedArray.add(namespaceWrappedArrayItem);
return this; return this;
@ -721,7 +721,7 @@ public class XmlItem {
public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) {
if (this.prefixNsArray == null) { if (this.prefixNsArray == null) {
this.prefixNsArray = new ArrayList<Integer>(); this.prefixNsArray = new ArrayList<>();
} }
this.prefixNsArray.add(prefixNsArrayItem); this.prefixNsArray.add(prefixNsArrayItem);
return this; return this;
@ -749,7 +749,7 @@ public class XmlItem {
public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) {
if (this.prefixNsWrappedArray == null) { if (this.prefixNsWrappedArray == null) {
this.prefixNsWrappedArray = new ArrayList<Integer>(); this.prefixNsWrappedArray = new ArrayList<>();
} }
this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem);
return this; return this;