多引用链式模式的json模式验证

roejwanj  于 2021-06-26  发布在  Hive
关注(0)|答案(0)|浏览(292)

我想做三件事
根据json模式验证json
创建json模式到avro模式转换器
创建json架构到配置单元表转换器
我面临的问题是模式有一个引用链。我正在尝试使用这个json模式验证器,它解析引用并验证,但目前出现了一些错误。但是我还没有找到第二个和第三个任务的任何库。
我必须为这些创建nifi处理器。我第一次就做了。
我的一个想法是使用一个内联解析器来遵从模式,创建一个大的模式并将其用于任务,希望以后一切都能顺利进行。
任何关于解决这些问题的好方法的建议。其中一个模式已附加。任何帮助都将不胜感激。

{
  "id": "/schemas/bi/events/identification/carrier",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Users Carrier Identified",
  "description": "A successfully identified carrier of a user",
  "type": "object",
  "definitions": {
    "carrier_identification_result": {
      "type": "object",
      "properties": {
        "mno": {
          "type": "string",
          "title": "Mobile network operator",
          "description": "The Mobile network operator",
          "example": "Telekom"
        },
        "mvno": {
          "type": "string",
          "title": " Mobile virtual network operator",
          "description": "The Mobile virtual network operator.",
          "example": "Mobilcom-Debitel"
        },
        "mcc": {
          "type": "string",
          "title": "Mobile Country Code",
          "description": "The Mobile Country Code as defined in the ITU-T Recommendation E.212",
          "example": "262"
        },
        "mnc": {
          "type": "string",
          "title": "Mobile Network Code",
          "description": "The Mobile Network Code as defined in the ITU-T Recommendation E.212",
          "example": "01"
        },
        "country": {
          "type": "string",
          "title": "The code ISO 3166-1 alpha 2 for the country",
          "example": "DE"
        }
      },
      "required": [
        "mno",
        "country"
      ]
    }
  },
  "allOf": [
    {
      "$ref": "../identification_service.json"
    },
    {
      "properties": {
        "type": {
          "constant": "identification.carrier",
          "example": "identification.carrier"
        },
        "event_data": {
          "allOf": [
            {
              "$ref": "../identification_service.json#/definitions/event_data"
            },
            {
              "type": "object",
              "properties": {
                "result": {
                  "$ref": "#/definitions/carrier_identification_result"
                },
                "required": [
                  "result"
                ]
              }
            }
          ]
        }
      }
    }
  ]
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题