从 syncthing JSON 生成 JSON 模式
Generating JSON schema from syncthing JSON
正在尝试生成下面的 JSON 架构(http://jsonschema.net) from the syncthing (https://docs.syncthing.net/rest/system-connections-get.html)JSON。
问题是连接对象以它们的 ID 开头(例如
YZJBJFX-RDB...),它被解释为一种类型。
是来自同步的 JSON 不标准还是模式生成器的问题?
如果模式生成是必需的(即无需手动输入模式),您对如何解决这个问题有什么建议吗?
{
"total":{
"paused":false,
"clientVersion":"",
"at":"2015-11-07T17:29:47.691637262+01:00",
"connected":false,
"inBytesTotal":1479,
"type":"",
"outBytesTotal":1318,
"address":""
},
"connections":{
"YZJBJFX-RDBL7WY-6ZGKJ2D-4MJB4E7-ZATSDUY-LD6Y3L3-MLFUYWE-AEMXJAC":{
"connected":true,
"inBytesTotal":556,
"paused":false,
"at":"2015-11-07T17:29:47.691548971+01:00",
"clientVersion":"v0.12.1",
"address":"127.0.0.1:22002",
"type":"TCP (Client)",
"outBytesTotal":550
},
"DOVII4U-SQEEESM-VZ2CVTC-CJM4YN5-QNV7DCU-5U3ASRL-YVFG6TH-W5DV5AA":{
"outBytesTotal":0,
"type":"",
"address":"",
"at":"0001-01-01T00:00:00Z",
"clientVersion":"",
"paused":false,
"inBytesTotal":0,
"connected":false
},
"UYGDMA4-TPHOFO5-2VQYDCC-7CWX7XW-INZINQT-LE4B42N-4JUZTSM-IWCSXA4":{
"address":"",
"type":"",
"outBytesTotal":0,
"connected":false,
"inBytesTotal":0,
"paused":false,
"at":"0001-01-01T00:00:00Z",
"clientVersion":""
}
}
}
欢迎任何意见。
Is it the JSON from synching that isn't standard or is it the issue
with the schema generator?
这个JSON没有什么不标准的地方。架构生成也没有任何问题。
不幸的是,为有效的动态内容定义架构很困难。情况总是如此,因为模式的工作是描述静态数据结构。
也就是说,可以使用 JSON 架构中的 patternProperties 字段来执行此操作。 This post 实际上是在问与您相同的问题。
正在尝试生成下面的 JSON 架构(http://jsonschema.net) from the syncthing (https://docs.syncthing.net/rest/system-connections-get.html)JSON。
问题是连接对象以它们的 ID 开头(例如 YZJBJFX-RDB...),它被解释为一种类型。
是来自同步的 JSON 不标准还是模式生成器的问题?
如果模式生成是必需的(即无需手动输入模式),您对如何解决这个问题有什么建议吗?
{
"total":{
"paused":false,
"clientVersion":"",
"at":"2015-11-07T17:29:47.691637262+01:00",
"connected":false,
"inBytesTotal":1479,
"type":"",
"outBytesTotal":1318,
"address":""
},
"connections":{
"YZJBJFX-RDBL7WY-6ZGKJ2D-4MJB4E7-ZATSDUY-LD6Y3L3-MLFUYWE-AEMXJAC":{
"connected":true,
"inBytesTotal":556,
"paused":false,
"at":"2015-11-07T17:29:47.691548971+01:00",
"clientVersion":"v0.12.1",
"address":"127.0.0.1:22002",
"type":"TCP (Client)",
"outBytesTotal":550
},
"DOVII4U-SQEEESM-VZ2CVTC-CJM4YN5-QNV7DCU-5U3ASRL-YVFG6TH-W5DV5AA":{
"outBytesTotal":0,
"type":"",
"address":"",
"at":"0001-01-01T00:00:00Z",
"clientVersion":"",
"paused":false,
"inBytesTotal":0,
"connected":false
},
"UYGDMA4-TPHOFO5-2VQYDCC-7CWX7XW-INZINQT-LE4B42N-4JUZTSM-IWCSXA4":{
"address":"",
"type":"",
"outBytesTotal":0,
"connected":false,
"inBytesTotal":0,
"paused":false,
"at":"0001-01-01T00:00:00Z",
"clientVersion":""
}
}
}
欢迎任何意见。
Is it the JSON from synching that isn't standard or is it the issue with the schema generator?
这个JSON没有什么不标准的地方。架构生成也没有任何问题。
不幸的是,为有效的动态内容定义架构很困难。情况总是如此,因为模式的工作是描述静态数据结构。
也就是说,可以使用 JSON 架构中的 patternProperties 字段来执行此操作。 This post 实际上是在问与您相同的问题。