【问题标题】:Customize katharsis json response自定义 kathasis json 响应
【发布时间】:2017-03-24 01:27:51
【问题描述】:

我正在使用katharsis,我想自定义响应,以下是katharsis响应。

 {
 "type": "table-name",
 "id": "A",
 "attributes": {
 "description": "AAA"
},
"relationships": {

 },
 "links": {
   "self": "http://localhost/table-name/A"
 }
}

如何去掉链接下的""self": "http://localhost/table-name/A""?

【问题讨论】:

  • 我相信有一个未解决的问题要求这样做,但目前不能直接使用。

标签: json json-api katharsis


【解决方案1】:

在 Katharsis Dto 中添加 String 字段,为此字段赋予空值。 然后添加注解@JsonApiLinksInformation。 Katharsis 会将 ""self": "http://localhost/table-name/A"" 替换为空字符串

【讨论】:

  • 你有样本输出吗?
  • { "type": "table-name", "id": "A", "attributes": { "description": "AAA" }, "relationships": { }, "links ": "" }
猜你喜欢
  • 2016-04-10
  • 1970-01-01
  • 2016-12-25
  • 1970-01-01
  • 1970-01-01
  • 2016-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多