Redocly/redoc

Type: Array and nullable: true does not render nullable

Open

#1.155 geöffnet am 9. Jan. 2020

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)TypeScript (2.272 Forks)batch import
Type: Bughelp wanted

Repository-Metriken

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

Beschreibung

I have a response which either returns an array or null. I specify the return json schema with:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "array",
    "uniqueItems": true,
    "items": {
      ....
    }
  "nullable": true
}

But redoc does not render this like for other types e.g. integers.

I currently use the following workaround:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "oneOf": [
    {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "../shared/id.json#"
      }
    },
    {
      "type": "any"
      "nullable":true
    }
  ]
}

grafik

Contributor Guide