AbsaOSS / AbsaOSS/enceladus

Unification of absent values serialization in JSON.

Đang mở
#2,074 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
feature priority: undecided under discussion
Ngôn ngữ chính
Scala
Star
33
Fork
16
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Background
In Enceladus API V2 (and further on in V3), there are multiple serialization techniques used to get JSON representation of objects, and currently, they behave differently in terms of _absent_ fields serialization (`None` represented as `null`, true `null`s).

The first approach is the `ObjectMapper` used by native object mapping (Datasets, Schemas, MTs, PropDefs, ...), defined in [rest_api.Application](https://github.com/AbsaOSS/enceladus/blob/develop-ver-3.0/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/Application.scala#L49). This unfortunately lacks the `.setSerializationInclusion(Include.NON_ABSENT)` option to omit the empty fields during serialization.

The second approach used leverages `atum.utils.SerializationUtils.asJson` (e.g. used for Runs) that is configured to omit absent fields.
This dichotomy results in a differently looking JSON representation within a single REST API service.

The catch here is that direct unification would directly affect the current V2 serialization that is used - this may or may not be an issue, which is to be determined.

This became clear during https://github.com/absaoss/enceladus/issues/1692.

## Feature
Unifiy the serialization approach if possible.

## Example [Optional]
```json
{
"name":"propertyDefinition1",
"version":23,
"description":null,
"propertyType":{"_t":"StringPropertyType","suggestedValue":null},
...
}
```
vs
```json
{
"name":"propertyDefinition1",
"version":23,
"propertyType":{"_t":"StringPropertyType"},
...
}
```

## Proposed Solution [Optional]
Solution Ideas:
1. adjust the object mapper with `.setSerializationInclusion(Include.NON_ABSENT)` and reflect in testcases and test the UI @ API v2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.