* Check if an example should be displayed.
(schema: OpenAPIV3.SchemaObject)
| 142 | * Check if an example should be displayed. |
| 143 | */ |
| 144 | function shouldDisplayExample(schema: OpenAPIV3.SchemaObject): boolean { |
| 145 | return ( |
| 146 | (typeof schema.example === 'string' && !!schema.example) || |
| 147 | typeof schema.example === 'number' || |
| 148 | typeof schema.example === 'boolean' || |
| 149 | (Array.isArray(schema.example) && schema.example.length > 0) || |
| 150 | (typeof schema.example === 'object' && |
| 151 | schema.example !== null && |
| 152 | Object.keys(schema.example).length > 0) |
| 153 | ); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Get the class name for a status code. |
no outgoing calls
no test coverage detected