elements
elements copied to clipboard
Wrong order of additional model property in case of inheritance
I have three simple models (CompA, CompB and CompC).
CompB inherits all from CompA, CompC inherits from CompB. For the sake of simplicity CompB and CompC each extend the inherited model by only one property.
Current Behavior
For CompC the property "testC" is rendered first, while e.g. for CompB the property "testB" was added to the end.
Expected Behavior
As CompB simply adds the addtional property to the end, CompC should do the same.
Possible Workaround/Solution
none
Steps to Reproduce
openapi: 3.0.0 info: title: PolyTest version: '1.0' servers:
- url: 'http://localhost:3000'
paths:
'/comps/{id}':
parameters:
- schema:
type: string
name: id
in: path
required: true
get:
summary: Your GET endpoint
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/CompA'
- $ref: '#/components/schemas/CompB'
- $ref: '#/components/schemas/CompC'
discriminator:
propertyName: name
operationId: get-comps-id
components:
schemas:
CompA:
title: CompA
type: object
discriminator:
propertyName: name
properties:
id:
type: string
name:
type: string
required:
- id
- name CompB: title: CompB allOf:
- $ref: '#/components/schemas/CompA'
- type: object properties: testB: type: string CompC: title: CompC allOf:
- $ref: '#/components/schemas/CompB'
- type: object properties: testC: type: string
- schema:
type: string
name: id
in: path
required: true
get:
summary: Your GET endpoint
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/CompA'
- $ref: '#/components/schemas/CompB'
- $ref: '#/components/schemas/CompC'
discriminator:
propertyName: name
operationId: get-comps-id
components:
schemas:
CompA:
title: CompA
type: object
discriminator:
propertyName: name
properties:
id:
type: string
name:
type: string
required:
CompA
CompB extends CompA by one property "testB" which will be added as last property. IMO this is correct.
CompC extends now CompB by one property "testC", but this property will now be displayed as first property. Why? And the example on the right side does not change as well.
- Version used: 7.5.19
- Environment name and version (e.g. Chrome 39, node.js 5.4):
- Operating System and version (desktop or mobile):
- Link to your environment/workspace/project: