RicoSuter/NJsonSchema

Schema inference fails with nested arrays

Open

#871 geöffnet am 14. Jan. 2019

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C# (550 Forks)github user discovery
help wantedtype: enhancement

Repository-Metriken

Stars
 (1.578 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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.

Contributor Guide