Open
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: Firefox
- Version: 130.0b7
- Method of installation: npm
- Swagger-UI version: 5.17.14
- Swagger/OpenAPI version: OpenAPI 3.1
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.1.0
info:
title: Never type render issue demo
version: 0.0.0
components:
schemas:
base_type:
type: object
additionalProperties: false
properties:
foo:
type: string
bar:
type: number
baz:
type: boolean
paths:
/test:
get:
responses:
'200':
description: This is a test
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/base_type'
- properties:
bar: false
Swagger-UI configuration options:
SwaggerUI({
url: "./openapi.json"
})
Describe the bug you're encountering
When using never
typed objects in the JSON schema, they are correctly displayed as never
in the schema preview box, but get rendered as "string"
in the automatically generated sample inputs.
To reproduce...
Steps to reproduce the behavior:
- Go to the Swagger Editor
- Paste the above OpenAPI definition into the panel on the left
- Click the
/test
endpoint under thedefault
tag - Click between
Example Value
andSchema
to see the difference in expected types.
Expected behavior
Fields with the never
type should be omitted from the example value generator
Screenshots
Additional context or thoughts
Not sure if this is a problem with Swagger-UI directly or the library that is being used to generate the previews internally.