swagger 정보 커스터마이징
This commit is contained in:
@@ -2,16 +2,33 @@ package com.example.restfulwebservice.config;
|
|||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import springfox.documentation.service.ApiInfo;
|
||||||
|
import springfox.documentation.service.Contact;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig {
|
||||||
|
private static final Contact DEFAULT_CONTACT = new Contact("Kim",
|
||||||
|
"http://www.joneconsulting.co.kr", "email@naver.com");
|
||||||
|
private static final ApiInfo DEFAULT_API_INFO = new ApiInfo("Awesome Api Title",
|
||||||
|
"My User management REST API service", "1.0", "uri:tos",
|
||||||
|
DEFAULT_CONTACT, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<>());
|
||||||
|
private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES = new HashSet<>(
|
||||||
|
Arrays.asList("application/json", "application/xml"));
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Docket api() {
|
public Docket api() {
|
||||||
return new Docket(DocumentationType.SWAGGER_2);
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
|
.apiInfo(DEFAULT_API_INFO)
|
||||||
|
.produces(DEFAULT_PRODUCES_AND_CONSUMES)
|
||||||
|
.consumes(DEFAULT_PRODUCES_AND_CONSUMES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.example.restfulwebservice.user;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFilter;
|
import com.fasterxml.jackson.annotation.JsonFilter;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -15,13 +17,19 @@ import java.util.Date;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
//@JsonFilter("UserInfo")
|
//@JsonFilter("UserInfo")
|
||||||
|
@ApiModel(description = "사용자 상세정보를 위한 도메인 객체")
|
||||||
public class User {
|
public class User {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@Size(min = 2, message = "Name은 2글자 이상 입력해 주세요.")
|
@Size(min = 2, message = "Name은 2글자 이상 입력해 주세요.")
|
||||||
|
@ApiModelProperty(notes = "사용자의 이름을 입력해 주세요")
|
||||||
private String name;
|
private String name;
|
||||||
@Past
|
@Past
|
||||||
|
@ApiModelProperty(notes = "사용자의 등록일을 입력해 주세요")
|
||||||
private Date joinDate;
|
private Date joinDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(notes = "사용자의 패스워드을 입력해 주세요")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(notes = "사용자의 주민번호을 입력해 주세요")
|
||||||
private String ssn;
|
private String ssn;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user