Open
Description
Q&A (please complete the following information)
- OS: [macOS]
- Browser: [chrome]
- Version: [online](https://editor.swagger.io/, https://editor-next.swagger.io/ )]
- Method of installation: [^^]
- Swagger-UI version: [^^]
- Swagger/OpenAPI version: [OpenAPI 3.1.0]
Content & configuration
I’m generating my OpenAPI specification using SpringDoc for my Kotlin project.
I’ve noticed that when I set the OpenAPI version to 3.0.x, Swagger UI renders my responses correctly. However, with the default version 3.1.0, it does not. The differences between the 3.0.x and 3.1.x specifications are minimal, so I believe this is an issue with Swagger UI.
To verify, I also tested the 3.1.0 specification with ReDoc, and it rendered correctly.
Swagger/OpenAPI definition:
openapi: 3.1.0
info:
title: Example
version: 1.0.0
paths: {}
components:
schemas:
Mercedes:
allOf:
- $ref: '#/components/schemas/Car'
- type: object
properties:
foo:
type: string
required:
- foo
- name
- type
Bmw:
allOf:
- $ref: '#/components/schemas/Car'
- type: object
properties:
bar:
type: string
required:
- name
- type
Car:
type: object
discriminator:
propertyName: type
required:
- name
- type
properties:
type:
type: string
description: Type discriminator
name:
type: string
MyResponse:
type: object
properties:
cars:
type: array
items:
oneOf:
- $ref: '#/components/schemas/Mercedes'
- $ref: '#/components/schemas/Bmw'
required:
- cars
Describe the bug you're encountering
This is what I get in swagger UI:
To reproduce...
Paste the yaml to https://editor.swagger.io/ or https://editor-next.swagger.io/