feat: JsonInclude.Include.NON_EMPTY 적용

dev
gitea-관리자 1 year ago
parent c62db6a6a7
commit 90c77d40a4

@ -77,7 +77,7 @@ spring:
data-source-properties:
rewriteBatchedStatements: true
# @JsonInclude(JsonInclude.Include.NON_NULL) 설정
# @JsonInclude(JsonInclude.Include.NON_EMPTY) 설정
jackson:
default-property-inclusion=non_null: non_null

@ -77,7 +77,7 @@ spring:
data-source-properties:
rewriteBatchedStatements: true
# @JsonInclude(JsonInclude.Include.NON_NULL) 설정
# @JsonInclude(JsonInclude.Include.NON_EMPTY) 설정
jackson:
default-property-inclusion=non_null: non_null

@ -92,8 +92,8 @@ ex) app:
@ Class Property 대소문자
Swagger API 사용시 대문자 필드 사용 불가
대문자 필드 사용시 @Schema 속성 및 데이타 전달 불가
@JsonProperty 또는 전체 클래스 필드인 경우 @JsonNaming 사용
json <-> java class 변환 적용 가능
@JsonProperty 또는 전체 클래스 필드인 경우 @JsonNaming 사용
json <-> java class 변환 적용
```text
@JsonNaming(value = PropertyNamingStrategies.UpperSnakeCaseStrategy.class)
public static class RequestDataHeader {
@ -141,3 +141,32 @@ json <-> java class 변환 적용 가능
-> getReqDtim
*/
```
## Json 데이타 null 필드 제외
@JsonInclude(JsonInclude.Include.NON_EMPTY)
```text
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.UpperSnakeCaseStrategy.class)
public static class RequestDataHeader {
/**
* <pre>
* TRAN_ID : 요청한값 그대로 return
* 고유번호 : 최대 24
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000")
@Size(min = 0, max = 24, message = "TRAN_ID는 24자를 넘을 수 없습니다.")
private String tranId;
/**
* CNTY_ID : 요청한값 그대로 return
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr")
@Size(min = 0, max = 2, message = "CNTY_ID는 2자를 넘을 수 없습니다.")
private String cntyId;
}
/*
{TRAN_ID : null or ""} --> tranId 필드 제외
*/
```

@ -33,7 +33,7 @@ public class CmmEnsFileDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class FmcExcelUpload {
//-----------------------------------------------------------------------------------
@ -95,7 +95,7 @@ public class CmmEnsFileDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class FmcExcel {
//-----------------------------------------------------------------------------------

@ -36,7 +36,7 @@ public class KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class Send implements IApiResponse {
/**
* :
@ -91,7 +91,7 @@ public class KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class Receiver {
/**
* CI
@ -137,7 +137,7 @@ public class KkopayDocAttrDTO {
@Data
@SuperBuilder
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class Property {
/**
* :
@ -185,7 +185,7 @@ public class KkopayDocAttrDTO {
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class DocumentBinderUuid implements IApiResponse {
/**
* (max:40) -
@ -200,7 +200,7 @@ public class KkopayDocAttrDTO {
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class DocStatus implements IApiResponse {
/**
* <pre>

@ -85,7 +85,7 @@ public class KkopayDocBulkDTO extends KkopayDocAttrDTO {
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class BulkSendRes {
/**
* ()(max=40) -
@ -148,7 +148,7 @@ public class KkopayDocBulkDTO extends KkopayDocAttrDTO {
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class BulkStatus {
/**
* (max:40) -

@ -106,7 +106,7 @@ public class KkopayDocDTO extends KkopayDocAttrDTO {
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class ValidTokenResponse implements IApiResponse {
/**
* ( USED) :
@ -192,7 +192,7 @@ public class KkopayDocDTO extends KkopayDocAttrDTO {
@NoArgsConstructor
@AllArgsConstructor
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@EqualsAndHashCode(callSuper = true)
public static class OneTimeToken extends ValidTokenRequest {
/**

@ -1,6 +1,7 @@
package kr.xit.biz.ens.model.nice;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
@ -52,7 +53,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public static class TokenRequest {
/**
@ -84,7 +85,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class TokenResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
@ -105,7 +106,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class TokenRevokeResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@ -124,7 +125,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public static class TokenResDataBody {
//-----------------------------------------------------------------------
@ -189,7 +190,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class PublickeyRequest {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
@ -210,7 +211,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class PublickeyResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
@Valid
@ -232,7 +233,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public static class PublickeyReqDataBody {
/**
@ -254,7 +255,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public static class PublickeyResDataBody {
/**
@ -342,7 +343,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.UpperSnakeCaseStrategy.class)
public static class RequestDataHeader {
@ -376,7 +377,7 @@ public class NiceCiDTO {
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.UpperSnakeCaseStrategy.class)
public static class ResponseDataHeader {
/**

@ -31,7 +31,7 @@ public class JsonUtils {
public static String toJson(Object obj) {
ObjectMapper mapper = new ObjectMapper();
// null 필드 제
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.setSerializationInclusion(Include.NON_EMPTY);
// No serializer found for class 에러 - private 필드
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
// mapper.setSerializationInclusion(Include.NON_EMPTY);

Loading…
Cancel
Save