jsonschema - json to pojo 为自引用定义给出“路径不存在:定义”的错误
问题描述
我有一个在“定义”属性中有嵌套引用的 json 模式。我的意思是我定义了一个属性说“PropertyA”,然后定义了第二个属性称为“PropertyB”,它引用了“PropertyA”
当我使用https://www.jsonschema2pojo.org/上的预览按钮时,我得到了错误Path not present: definitions
。
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Inbox Item Datalake DTO",
"definitions": {
"PropertyA": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"PropertyB": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/PropertyA"
},
"default": []
}
}
}
},
"properties": {
"FinalProperty": {
"type": "array",
"items": {
"$ref": "#/definitions/PropertyB"
},
"default": []
}
}
}
我在网上看到了一些关于使用绝对路径的帖子,但这是在完全相同的文件中,我没有看到任何关于此的内容,因此将不胜感激。
解决方案
推荐阅读
- r - 执行任务的循环函数 R
- .htaccess - 重定向无法正常工作
- validation - .NET Core - FluentValidation - 跨字段验证
- sql - 在没有子查询的情况下,在 BigQuery 中获取最接近给定日期的日期
- arrays - 如何在 mongodb 聚合中仅投影匹配的数组项?
- python - TypeError: typing.Any 不能与 isinstance() 一起使用
- c# - 如果所有子项都为空,则删除父项和子项
- java - 在java中将UTC时间转换为欧洲/伦敦时区
- azure-devops-rest-api - 如何获取与排队 CI 关联的搁置集?
- c# - 通过 TCP/IP 从 C# 应用程序向 IBM Doors 发送 DXL 命令