4

JSON.Net JsonSchemaGenerator を使用してオブジェクトの JSON スキーマを生成する場合:

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

type プロパティを文字列の配列として生成します。

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

適切な JSON スキーマは次のようになります。

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

誰もこれを見たことがありますか?

4

1 に答える 1

4

これは文字列の配列ではなく、null 許容の stringです。

{ "type": [ "string", "null" ] }値が文字列または null であることを意味します。文字列の配列は次のようになります{ "type": "array", "items": { "type": "string" } }

于 2013-07-16T08:31:20.627 に答える