2
안녕하세요이 다음과 같은 시나리오 :json.net에서 유효성이 검사 된 포인터는 어떻게 작성합니까?
JSON 객체 :
{
"$id": "1",
"someProp": "123",
"children": [{
"$id": "2",
"$type": "ClassB",
"Parent": {
"$ref": "1"
}
}]
}
JSON 스키마 :
{
"id": "ClassA",
"required": true,
"type": [
"object",
"null"
],
"properties": {
"someProp": {
"required": true,
"type": [
"string",
"null"
]
},
"children": {
"id": "List<Child>",
"required": true,
"type": [
"array",
"null"
],
"items": {
"id": "Child",
"type": [
"object",
"null"
],
"properties": {
"id": {
"required": true,
"type": "integer"
},
"parent": {
"$ref": "ClassA"
}
}
}
}
}
}
내가 참조 루프를 가진 복잡한 객체를, 그래서 구성한 json.net 객체가 직렬화 될 때 참조를 만든다. 모든 것은 내가 직렬화와 객체를 직렬화 할 수 있습니다 예상대로 작동하지만 위의 스키마와 JSON 객체의 유효성을 검사하고 때 다음과 같은 오류가 발생했습니다 :
필수 속성이 객체에서 누락 된 "someProp"경로 : object.Children [0] .parent
그리고 어떻게 스키마를 참조 JSON 객체로 보일 수 있습니까?