Hi,
It seems that having an array of types (which is valid json schema) is not supported by this tool. For example "type": ["string", "null"] is displayed as "stringnull".

After taking a quick look at the code I believe the problem is coming from the following piece where the assumption is made that type is always a single value.
|
<TableCell style={{ |
|
...styles.cellWidth, |
|
color: colorMap[schema.type as any], |
|
}}>{schema.type}</TableCell> |
Using an array of types is particularly convenient to define a simple nullable type like a nullable string for example. A workaround is to use oneOf but this is a bit more verbose so it would be nice to support array of types I think.
Thanks,
Antoine
Hi,
It seems that having an array of types (which is valid json schema) is not supported by this tool. For example
"type": ["string", "null"]is displayed as "stringnull".After taking a quick look at the code I believe the problem is coming from the following piece where the assumption is made that
typeis always a single value.docs-react/src/JSONSchema/SchemaRenderer.tsx
Lines 172 to 175 in f8a233b
Using an array of types is particularly convenient to define a simple nullable type like a nullable string for example. A workaround is to use
oneOfbut this is a bit more verbose so it would be nice to support array of types I think.Thanks,
Antoine