-
Notifications
You must be signed in to change notification settings - Fork 295
Description
Describe the bug
anyOf:
- type: string
- type: 'null'As in the above OpenAPI Spec, when you use type: "null" as one of the options in anyOf/oneOf, nothing is shown when the tab is opened. As a result, users of the API reference can't tell what they are supposed to enter.
Expected behavior
Just like string or boolean, it would be better to display null as well.
Also, for the tab labels, instead of using names like MOD1 or MOD2, it would be clearer and more helpful to show the type names such as string, boolean, and null.
In fact, when an object is specified using $ref, the object name is displayed.
Current behavior
anyOf:
- type: string
- type: integer
- type: boolean
- type: 'null'When this definition is used, nothing is displayed when the fourth tab is selected.
Possible solution
Schema/index.tsx#L125
You just need to add null to this array.
Also, you can use type instead of MOD here. Schema/index.tsx#L116
const label = anyOneSchema.title || anyOneSchema.type;
Steps to reproduce
- Define
type: 'null'inanyOfin the OpenAPI Spec. - Generate the API reference.
- Open the relevant API reference and select the
anyOftab. - A tab opens, but nothing is displayed.
Screenshots
Context
This is necessary to comply with OpenAPI 3.1.
As discussed here: #1017 , rendering now works correctly when null is included in a type array.
However, there are still issues with anyOf and oneOf.
#950 (comment)
Your Environment
- Version used: v4.4.0
- Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3):
- Operating System and version (desktop or mobile): both
- Link to your project:

