Reputation: 658
Json.Net.Schema is generating refernces for all of my string arrays. for example this c#
public string[] ovoImageUrl;
public string[] ovoMetaprofile;
produces this Json schema
"ovoImageUrl": {
"type": [
"array",
"null"
],
"items": {
"type": [
"string",
"null"
]
}
},
"ovoMetaprofile": {
"$ref": "#/properties/ovoImageUrl"
},
Since I am using the Json Schema as human readable documentation this is not desirable. is there any way, maybe with attributes, stop these "$ref" from being created?
Cheers, Grant
Upvotes: 2
Views: 1587
Reputation: 49052
The latest version of Newtonsoft.Json.Schema has a SchemaReferenceHandling
setting on JSchemaGenerator
for controlling references.
JSchemaGenerator generator = new JSchemaGenerator();
generator.SchemaReferenceHandling = SchemaReferenceHandling.None;
JSchema schema = generator.Generate(typeof(Person));
Upvotes: 4