JsonSchema2pojo 不生成 POJO
JsonSchema2pojo doesnot generate POJO
我得到了如下的 pojo,
{
"id": "yyy",
"$schema": "http://json-schema.org/draft-04/schema#",
"packages":
{
"id": "#/packages",
"description": "XXX",
"type": "object",
"properties":
{
"xx":
{
"description": "Total number of elements in the collection.",
"type": "integer",
"minimum": 1,
"minLength": 1
}
..............
...............
},
"additionalProperties": false,
"required":
[
"xx",
...
...
]
}
}
尝试使用 Jsonschema2POJO
生成 POJO 时,我只看到正在创建的包中没有 class 文件。甚至没有出现异常。
当我在 "packages" 标签周围添加一个 "properties" 时,它会生成 pojo,但是如果任何其他 json 引用这个 json 我会得到一个 "Path not present:packages"
错误,而且它使模式无效。
我想了解该工具是否对架构版本有任何限制?或者是否必须在提供的 json 中进行任何修改才能使其与该工具一起使用。请提出建议。
用对我有用的东西回答自己,
schema 隐藏在包中,jsonschema2pojo 看不到它。要使用这个模式,要么把它放在文件的根目录下,要么使用 $ref 从其他地方指向它(比如 "$ref":"#/packages".
单击 https://github.com/joelittlejohn/jsonschema2pojo/issues/366 进一步参考。
我得到了如下的 pojo,
{
"id": "yyy",
"$schema": "http://json-schema.org/draft-04/schema#",
"packages":
{
"id": "#/packages",
"description": "XXX",
"type": "object",
"properties":
{
"xx":
{
"description": "Total number of elements in the collection.",
"type": "integer",
"minimum": 1,
"minLength": 1
}
..............
...............
},
"additionalProperties": false,
"required":
[
"xx",
...
...
]
}
}
尝试使用 Jsonschema2POJO
生成 POJO 时,我只看到正在创建的包中没有 class 文件。甚至没有出现异常。
当我在 "packages" 标签周围添加一个 "properties" 时,它会生成 pojo,但是如果任何其他 json 引用这个 json 我会得到一个 "Path not present:packages"
错误,而且它使模式无效。
我想了解该工具是否对架构版本有任何限制?或者是否必须在提供的 json 中进行任何修改才能使其与该工具一起使用。请提出建议。
用对我有用的东西回答自己, schema 隐藏在包中,jsonschema2pojo 看不到它。要使用这个模式,要么把它放在文件的根目录下,要么使用 $ref 从其他地方指向它(比如 "$ref":"#/packages".
单击 https://github.com/joelittlejohn/jsonschema2pojo/issues/366 进一步参考。