У меня есть действующая схема json, как показано ниже
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "abcd",
"title": "test schema",
"description": "............",
"type": "object",
"properties": {
"a": {
...........
...........
},
"b": {
.........
........
.........
},
"c": {
...........
..........
},
"d": {
...........
..........
}
},
"anyOf": [
{
"type": "object",
"$ref": "#/properties/a",
"$ref": "#/properties/b"
},
{
"type": "object",
"$ref": "#/properties/c",
"$ref": "#/properties/d"
}
]
}
Схема выше хранится в файле, и я загружаю ее для анализа, который можно увидеть ниже
JSchema schema =
JSchema.Parse(File.ReadAllText(@"D:\Backups\testschema.json"));
Итак, когда я смотрю на вывод схемы, он выглядит следующим образом:
My Json Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "abcd",
"title": "test schema",
"description": "............",
"type": "object",
"properties": {
"a": {
...........
...........
},
"b": {
.........
........
.........
},
"c": {
...........
..........
},
"d": {
...........
..........
}
},
"anyOf": [
{
"$ref": "#/properties/b"
},
{
"$ref": "#/properties/d"
}
]
}
I'm wondering why I'm getting only the last reference under the anyOf property
On parsing shouldn't the output be the same as that in the file?
Am I missing something?
My desired output under anyOf is
"anyOf": [
{
"type": "object",
"$ref": "#/properties/a",
"$ref": "#/properties/b"
},
{
"type": "object",
"$ref": "#/properties/c",
"$ref": "#/properties/d"
}
]
Есть мысли о том, как мне достичь желаемого результата?