如何为对象创建醒目的示例?

时间:2019-04-22 05:24:34

标签: rest annotations swagger

我正试图为JsonNode对象创建示例。 这是课程。

 public class DatasetInfo {

  @Getter @Setter @JsonProperty
  @Schema(description = "ID", example = "12345")
  private String id;

  @Getter @Setter @JsonProperty
  @Schema(description = "Dataset definition", example = "{\n" +
          "            \"name\": \"tom\",\n" +
          "            \"description\": \"test\"\n" +
          "          }")
  private JsonNode result;

}

我大摇大摆地检查了一下。该示例显示:

{
  "id": "a",
  "name": "abc",
  "result": {
    "array": true,
    "null": true,
    "number": true,
    "containerNode": true,
    "missingNode": true,
    "object": true,
    "valueNode": true,
    "pojo": true,
    "boolean": true,
    "long": true,
    "textual": true,
    "integralNumber": true,
    "binary": true,
    "short": true,
    "int": true,
    "double": true,
    "float": true,
    "nodeType": "ARRAY",
    "bigDecimal": true,
    "bigInteger": true,
    "floatingPointNumber": true
  }
}

它列出了所有可能的json节点,这不是预期的。我期望的例子是这样的:

{
      "id": 12345",
      "result": {
        "name": "tom",
        "description": "test"
      }
    }

如何创建此示例?

0 个答案:

没有答案