Open jeroendk opened 1 year ago
I have essentially the same issue but with Swagger 2.0 and destinations
before paths
.
Example Swagger definition:
basePath: /
definitions:
A:
allOf:
- $ref: '#/definitions/B'
- properties:
a:
type: integer
type: object
B:
allOf:
- $ref: '#/definitions/C'
- properties:
b:
type: number
type: object
C:
allOf:
- $ref: '#/definitions/D'
- properties:
c:
type: string
type: object
D:
properties:
d:
type: boolean
type: object
info:
title: Test
version: '1.0'
paths:
/get:
get:
responses:
'200':
description: Successful response
schema:
$ref: '#/definitions/A'
summary: Get things
swagger: '2.0'
Swagger-UI configuration options:
window.ui = SwaggerUIBundle({
url: "https://{my domain and path}/swagger_minimal.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
https://{my domain and path}/swagger-ui-4.15.5/dist/#/default/get_get
When definitions
appear before paths
in our swagger schema, and several levels of nested allOf
, not all properties are shown in the Path-Response-Model view.
Steps to reproduce the behavior:
a
and b
are shownI expect to see properties a
, b
, c
, d
.
Should be:
When placing paths
before definitions
things appear correctly. I haven't found any explicit mention in the Swagger specification that fields shall appear in a certain order, so I think this is a bug in swagger-ui. My swagger generator produces the fields in random or lexicographical order depending on environment.
When skipping the C
definition and letting B
reference D
directly, I see three properties as expected. So it seems to me that, at least with my example, swagger-ui can handle two levels of allOf
but not three levels.
I have tried my example Swagger definition with swagger-ui versions 4.15.5, 4.0.0, 3.36.1, 3.36.0, and 3.24.3.
With 3.36.1 and higher I see only properties a
, b
, as described above.
With 3.36.0 and lower I see only properties c
, d
.
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Swagger-UI configuration options:
Describe the bug you're encountering
When the
paths
key is defined after thecomponents
key, theallOf
$ref properties are not rendered properlyTo reproduce...
Steps to reproduce the behavior:
/pets
id
field is visibleExpected behavior
All the fields of the $ref should be visible
Screenshots
Should be:![image](https://user-images.githubusercontent.com/4716348/200781574-9ddd5497-bc0f-4fdb-bd93-5df33592045f.png)
Additional context or thoughts
This issue is also defined in #5194 and should be fixed in an older version, but seems to be broken (again)?