RicoSuter/NJsonSchema

Schema inference fails with nested arrays

Open

#871 建立於 2019年1月14日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)C# (550 fork)github user discovery
help wantedtype: enhancement

倉庫指標

Star
 (1,578 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

If you use JsonSchema4.FromSampleJson to infer schema from this JSON { "hi": [[10, 20], [30, 40]] }, I would expect it to detect that its an array of array of integers. But instead I get an array of type-less arrays:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "hi": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Anonymous3"
      }
    }
  },
  "definitions": {
    "Hi": {
      "type": "integer"
    },
    "Anonymous2": {
      "type": "integer"
    },
    "Anonymous3": {
      "type": "array"
    }
  }
}

Not sure whether this is by design or a bug.

貢獻者指南