forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
f4d78079de
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,7 +5,7 @@ out/
|
|||||||
*.iws
|
*.iws
|
||||||
classpath.txt
|
classpath.txt
|
||||||
version.properties
|
version.properties
|
||||||
!modules/swagger-codegen-cli/src/main/resources/version.properties
|
!modules/swagger-codegen/src/main/resources/version.properties
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
lib/*
|
lib/*
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>true</filtering>
|
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>logback.xml</exclude>
|
<exclude>logback.xml</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
@ -79,17 +78,6 @@
|
|||||||
<artifactId>swagger-codegen</artifactId>
|
<artifactId>swagger-codegen</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--https://github.com/airlift/airline-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.airlift</groupId>
|
|
||||||
<artifactId>airline</artifactId>
|
|
||||||
<version>0.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.googlecode.lambdaj</groupId>
|
|
||||||
<artifactId>lambdaj</artifactId>
|
|
||||||
<version>2.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
@ -1 +0,0 @@
|
|||||||
version = ${project.version}
|
|
@ -16,6 +16,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>logback.xml</exclude>
|
<exclude>logback.xml</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
@ -249,6 +250,16 @@
|
|||||||
<artifactId>commons-cli</artifactId>
|
<artifactId>commons-cli</artifactId>
|
||||||
<version>${commons-cli-version}</version>
|
<version>${commons-cli-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.airlift</groupId>
|
||||||
|
<artifactId>airline</artifactId>
|
||||||
|
<version>0.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.lambdaj</groupId>
|
||||||
|
<artifactId>lambdaj</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>testng</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
|
@ -2,6 +2,7 @@ package io.swagger.codegen;
|
|||||||
|
|
||||||
import com.samskivert.mustache.Mustache;
|
import com.samskivert.mustache.Mustache;
|
||||||
import com.samskivert.mustache.Template;
|
import com.samskivert.mustache.Template;
|
||||||
|
import io.swagger.codegen.cmd.Version;
|
||||||
import io.swagger.codegen.ignore.CodegenIgnoreProcessor;
|
import io.swagger.codegen.ignore.CodegenIgnoreProcessor;
|
||||||
import io.swagger.models.*;
|
import io.swagger.models.*;
|
||||||
import io.swagger.models.auth.OAuth2Definition;
|
import io.swagger.models.auth.OAuth2Definition;
|
||||||
@ -10,6 +11,7 @@ import io.swagger.models.parameters.Parameter;
|
|||||||
import io.swagger.util.Json;
|
import io.swagger.util.Json;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -17,8 +19,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||||
protected final Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
|
protected final Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
|
||||||
protected CodegenConfig config;
|
protected CodegenConfig config;
|
||||||
@ -127,8 +127,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
config.processOpts();
|
config.processOpts();
|
||||||
config.preprocessSwagger(swagger);
|
config.preprocessSwagger(swagger);
|
||||||
// TODO need to obtain version from a file instead of hardcoding it
|
// TODO need to obtain version from a file instead of hardcoding it
|
||||||
config.additionalProperties().put("generatorVersion", "2.2.3-SNAPSHOT");
|
|
||||||
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||||
|
config.additionalProperties().put("generatorVersion", Version.readVersionFromResources());
|
||||||
config.additionalProperties().put("generatorClass", config.getClass().getName());
|
config.additionalProperties().put("generatorClass", config.getClass().getName());
|
||||||
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
||||||
if (swagger.getVendorExtensions() != null) {
|
if (swagger.getVendorExtensions() != null) {
|
||||||
|
@ -13,7 +13,6 @@ import java.io.IOException;
|
|||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
public class SpringCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
|
public class SpringCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program ({{{generatorVersion}}}).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package {{package}};
|
package {{package}};
|
||||||
|
|
||||||
{{#imports}}import {{import}};
|
{{#imports}}import {{import}};
|
||||||
|
@ -32,6 +32,12 @@ import javax.validation.Valid;
|
|||||||
@Controller
|
@Controller
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
public class {{classname}}Controller implements {{classname}} {
|
public class {{classname}}Controller implements {{classname}} {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public {{classname}}Controller(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
{{#isDelegate}}
|
{{#isDelegate}}
|
||||||
private final {{classname}}Delegate delegate;
|
private final {{classname}}Delegate delegate;
|
||||||
|
|
||||||
@ -49,11 +55,7 @@ public class {{classname}}Controller implements {{classname}} {
|
|||||||
{{^isDelegate}}
|
{{^isDelegate}}
|
||||||
{{^async}}
|
{{^async}}
|
||||||
{{#examples}}
|
{{#examples}}
|
||||||
{{#-first}}
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
{{/-first}}
|
|
||||||
if (accept != null && accept.contains("{{{contentType}}}")) {
|
if (accept != null && accept.contains("{{{contentType}}}")) {
|
||||||
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK);
|
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import org.springframework.context.annotation.ComponentScan;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
@ -66,21 +67,23 @@ public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Jackson2ObjectMapperBuilder builder() {
|
||||||
|
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder()
|
||||||
|
.indentOutput(true)
|
||||||
|
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||||
|
.dateFormat(new RFC3339DateFormat());
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
converters.add(new MappingJackson2HttpMessageConverter(objectMapper()));
|
||||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
|
||||||
.dateFormat(new RFC3339DateFormat())
|
|
||||||
.build();
|
|
||||||
{{#threetenbp}}
|
|
||||||
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);
|
|
||||||
objectMapper.registerModule(module);
|
|
||||||
{{/threetenbp}}
|
|
||||||
converters.add(new MappingJackson2HttpMessageConverter(objectMapper));
|
|
||||||
super.configureMessageConverters(converters);
|
super.configureMessageConverters(converters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ObjectMapper objectMapper(){
|
||||||
|
return builder().build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
version = ${project.version}
|
@ -9,8 +9,8 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 25
|
||||||
buildToolsVersion '23.0.2'
|
buildToolsVersion '25.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 23
|
targetSdkVersion 25
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -7,4 +7,10 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class FakeApiController implements FakeApi {
|
public class FakeApiController implements FakeApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public FakeApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.Client;
|
import io.swagger.model.Client;
|
||||||
|
@ -7,4 +7,10 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class FakeClassnameTestApiController implements FakeClassnameTestApi {
|
public class FakeClassnameTestApiController implements FakeClassnameTestApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public FakeClassnameTestApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.ModelApiResponse;
|
import io.swagger.model.ModelApiResponse;
|
||||||
|
@ -7,4 +7,10 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class PetApiController implements PetApi {
|
public class PetApiController implements PetApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public PetApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -7,4 +7,10 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class StoreApiController implements StoreApi {
|
public class StoreApiController implements StoreApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public StoreApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -7,4 +7,10 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class UserApiController implements UserApi {
|
public class UserApiController implements UserApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public UserApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import org.springframework.context.annotation.ComponentScan;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
@ -58,14 +59,23 @@ public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Jackson2ObjectMapperBuilder builder() {
|
||||||
|
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder()
|
||||||
|
.indentOutput(true)
|
||||||
|
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||||
|
.dateFormat(new RFC3339DateFormat());
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
converters.add(new MappingJackson2HttpMessageConverter(objectMapper()));
|
||||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
|
||||||
.dateFormat(new RFC3339DateFormat())
|
|
||||||
.build();
|
|
||||||
converters.add(new MappingJackson2HttpMessageConverter(objectMapper));
|
|
||||||
super.configureMessageConverters(converters);
|
super.configureMessageConverters(converters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ObjectMapper objectMapper(){
|
||||||
|
return builder().build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -26,12 +26,16 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class FakeApiController implements FakeApi {
|
public class FakeApiController implements FakeApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public FakeApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body,
|
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body,
|
||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<Client>(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK);
|
return new ResponseEntity<Client>(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.Client;
|
import io.swagger.model.Client;
|
||||||
|
@ -23,12 +23,16 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class FakeClassnameTestApiController implements FakeClassnameTestApi {
|
public class FakeClassnameTestApiController implements FakeClassnameTestApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public FakeClassnameTestApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body,
|
public ResponseEntity<Client> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body,
|
||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<Client>(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK);
|
return new ResponseEntity<Client>(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import io.swagger.model.ModelApiResponse;
|
import io.swagger.model.ModelApiResponse;
|
||||||
|
@ -25,6 +25,12 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class PetApiController implements PetApi {
|
public class PetApiController implements PetApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public PetApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body,
|
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body,
|
||||||
@RequestHeader("Accept") String accept) {
|
@RequestHeader("Accept") String accept) {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -42,12 +48,11 @@ public class PetApiController implements PetApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<List<Pet>>(objectMapper.readValue("<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status></Pet>", List.class), HttpStatus.OK);
|
return new ResponseEntity<List<Pet>>(objectMapper.readValue("<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status></Pet>", List.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<List<Pet>>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK);
|
return new ResponseEntity<List<Pet>>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -59,12 +64,11 @@ public class PetApiController implements PetApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<List<Pet>>(objectMapper.readValue("<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status></Pet>", List.class), HttpStatus.OK);
|
return new ResponseEntity<List<Pet>>(objectMapper.readValue("<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status></Pet>", List.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<List<Pet>>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK);
|
return new ResponseEntity<List<Pet>>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -76,12 +80,11 @@ public class PetApiController implements PetApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<Pet>(objectMapper.readValue("<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status></Pet>", Pet.class), HttpStatus.OK);
|
return new ResponseEntity<Pet>(objectMapper.readValue("<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status></Pet>", Pet.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<Pet>(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK);
|
return new ResponseEntity<Pet>(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -109,8 +112,6 @@ public class PetApiController implements PetApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<ModelApiResponse>(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK);
|
return new ResponseEntity<ModelApiResponse>(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -24,6 +24,12 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class StoreApiController implements StoreApi {
|
public class StoreApiController implements StoreApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public StoreApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId,
|
public ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId,
|
||||||
@RequestHeader("Accept") String accept) {
|
@RequestHeader("Accept") String accept) {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -33,8 +39,6 @@ public class StoreApiController implements StoreApi {
|
|||||||
public ResponseEntity<Map<String, Integer>> getInventory(@RequestHeader("Accept") String accept) throws IOException {
|
public ResponseEntity<Map<String, Integer>> getInventory(@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<Map<String, Integer>>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK);
|
return new ResponseEntity<Map<String, Integer>>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -46,12 +50,11 @@ public class StoreApiController implements StoreApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<Order>(objectMapper.readValue("<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>", Order.class), HttpStatus.OK);
|
return new ResponseEntity<Order>(objectMapper.readValue("<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>", Order.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<Order>(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK);
|
return new ResponseEntity<Order>(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -63,12 +66,11 @@ public class StoreApiController implements StoreApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<Order>(objectMapper.readValue("<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>", Order.class), HttpStatus.OK);
|
return new ResponseEntity<Order>(objectMapper.readValue("<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>", Order.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<Order>(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK);
|
return new ResponseEntity<Order>(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
|
||||||
|
* https://github.com/swagger-api/swagger-codegen
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,6 +24,12 @@ import javax.validation.Valid;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class UserApiController implements UserApi {
|
public class UserApiController implements UserApi {
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public UserApiController(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body,
|
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body,
|
||||||
@RequestHeader("Accept") String accept) {
|
@RequestHeader("Accept") String accept) {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -52,12 +58,11 @@ public class UserApiController implements UserApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<User>(objectMapper.readValue("<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>", User.class), HttpStatus.OK);
|
return new ResponseEntity<User>(objectMapper.readValue("<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>", User.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<User>(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK);
|
return new ResponseEntity<User>(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@ -70,12 +75,11 @@ public class UserApiController implements UserApi {
|
|||||||
@RequestHeader("Accept") String accept) throws IOException {
|
@RequestHeader("Accept") String accept) throws IOException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/xml")) {
|
if (accept != null && accept.contains("application/xml")) {
|
||||||
return new ResponseEntity<String>(objectMapper.readValue("aeiou", String.class), HttpStatus.OK);
|
return new ResponseEntity<String>(objectMapper.readValue("aeiou", String.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (accept != null && accept.contains("application/json")) {
|
if (accept != null && accept.contains("application/json")) {
|
||||||
return new ResponseEntity<String>(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK);
|
return new ResponseEntity<String>(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.springframework.context.annotation.ComponentScan;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
@ -62,19 +63,23 @@ public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Jackson2ObjectMapperBuilder builder() {
|
||||||
|
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder()
|
||||||
|
.indentOutput(true)
|
||||||
|
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||||
|
.dateFormat(new RFC3339DateFormat());
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
converters.add(new MappingJackson2HttpMessageConverter(objectMapper()));
|
||||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
|
||||||
.dateFormat(new RFC3339DateFormat())
|
|
||||||
.build();
|
|
||||||
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);
|
|
||||||
objectMapper.registerModule(module);
|
|
||||||
converters.add(new MappingJackson2HttpMessageConverter(objectMapper));
|
|
||||||
super.configureMessageConverters(converters);
|
super.configureMessageConverters(converters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ObjectMapper objectMapper(){
|
||||||
|
return builder().build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user