JSON.Net does not generate the schema correctly (type as an array)

When using JSON.Net JsonSchemaGenerator to generate a JSON scheme for my object:

Public Class Host Public Property uid() As String End Class 

It generates a type property as an array of strings:

 { "type": "object", "properties": { "uid": { "required": true, "type": [ "string", "null" ] } } } 

The native JSON schema should be:

 { "type": "object", "properties": { "uid": { "required": true, "type": "string" } } } 

Has anyone seen this before?

+4
source share
1 answer

This is not an array of strings; it is a null string .

{ "type": [ "string", "null" ] } means that the valus value is a string or null value. The array of strings will be { "type": "array", "items": { "type": "string" } }

+4
source

Source: https://habr.com/ru/post/1491506/


All Articles