-
Notifications
You must be signed in to change notification settings - Fork 764
Description
Say we have two definitions: Pet and Cat. Cat extends Pet using the allOf function.
After swagger-js parses the spec, the resulting definition for Cat contains a $ref property with the value of PATH/Pet, instead of the expected value of PATH/Cat.
This results in swagger-ui displaying the wrong name and tooltips for models that were built using allOf, as seen in the screenshots below:
This screenshot shows the name of the model, and its $ref value. Note that the Cat model has an incorrect $ref value.
This screenshot shows the incorrect value of the tooltip when hovering the Cat model name.
This screenshot shows the incorrect name of the model and incorrect value of the tooltip for the Cat model, which is inside a oneOf option of the Animal model.
The issue is happening with OAS 2.0 and OAS 3.0 specs.
openapi: 3.0.0
info:
version: 0.0.0
title: test
paths: {}
components:
schemas:
Pet:
type: object
properties:
name:
type: string
required:
- name
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
meowVolume:
type: string
enum:
- loud
- quiet
Animal:
type: object
properties:
pet:
$ref: '#/components/schemas/Pet'
cat:
$ref: '#/components/schemas/Cat'
swagger: "2.0"
info:
version: 0.0.0
title: test
paths: {}
definitions:
Pet:
type: object
properties:
name:
type: string
required:
- name
Cat:
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
meowVolume:
type: string
enum:
- loud
- quiet
Animal:
type: object
properties:
pet:
$ref: '#/definitions/Pet'
cat:
$ref: '#/definitions/Cat'


