【发布时间】:2019-05-11 07:30:16
【问题描述】:
我有一个 API 可以通过 fields 属性中的属性提供这样的数据。
{
records: [
{
id: "123",
fields: {
author: {
id: "1",
name: "Paul"
},
title: "My awesome blog post",
comments: [
{
id: "324",
commenter: {
id: "2",
name: "Nicole"
}
}
]
}
}
]
};
在规范化时,我现在使用简单的 processStrategy: (input, parent, key) => input.fields 来处理这个问题,但我想再次对其进行非规范化,以便非规范化的实体包含此字段结构,因为 API 期望这样。
到目前为止,使用const denormalizedData = denormalize([123], [article], normalizedData.entities) 对我的规范化数据进行非规范化会省略该字段:
[
{
"author": {
"id": "1",
"name": "Paul"
},
"title": "My awesome blog post",
"comments": [
{
"id": "324",
"commenter": {
"id": "2",
"name": "Nicole"
}
}
]
}
]
我在api docs 中找不到任何关于如何在非规范化上添加额外处理的内容,知道吗?
【问题讨论】:
标签: normalizr