繁体   English   中英

与JsonNode结合使用

[英]Using swagger with JsonNode

我有一个PATCH方法,它将输入的JSON用作JsonNode通过JSON Schema对其进行验证并执行一些逻辑。

方法:

@PatchMapping(UPDATE_OR_ADD_LINE, produces = [APPLICATION_JSON_VALUE])
fun updateOrAddLines(@PathVariable id: String, @RequestBody request: JsonNode): Response {
    validationService.validatePatchLines(request = request)
    return lineService.updateOrAddLines(id = id, request = request)
}

JSON模式:

{
  "definitions": {},
  "type": "object",
  "required": [
    "updateBy",
    "lines"
  ],
  "properties": {
    "updateBy": {
      "type": "string",
      "minLength": 1,
      "pattern": "^(.*)$"
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "lineId"
        ],
        "properties": {
          "lineId": {
            "type": "string",
            "pattern": "^(.*)$"
          },
          "itemReference": {
            "type": "string",
            "pattern": "^(.*)$"
          },
          "price": {
            "type": "number",
            "minimum": 0.0
          },
          "quantity": {
            "type": "number",
            "minimum": 0.0
          }
        }
      }
    }
  }
}

问题:生成的Swagger不会将输入显示为显示所有JSON属性的JSON模型。

期望:我想通过JSON模式生成Swagger

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM