-
-
Notifications
You must be signed in to change notification settings - Fork 549
Closed
Description
Description
Passing a JSON array with multiple types to JsonSchema.FromSampleJson return only the first element of the array a JsonSchema.
Executing this line JsonSchema.FromSampleJson([1, { "a": "b"}, "value"] )
Actual result :
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "integer"
}
}Expected Result :
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"anyOf": [
{
"type": "integer"
},
{
"type": "object"
},
{
"type": "string"
}
]
}
}The problem may be there.
https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema/Generation/SampleJsonSchemaGenerator.cs#:~:text=schema.Item%20%3D%20itemSchemas.First()%3B