Open
Description
The discriminator functionnality is broken when using with external files. Here's a reproducible test case :
openapi: 3.0.0
info:
title: test
version: 1.0.0
paths:
/test:
get:
responses:
'200':
description: test
content:
'application/json':
schema:
oneOf:
- $ref: './external-file.yaml#/components/schemas/simpleObject'
- $ref: './external-file.yaml#/components/schemas/complexObject'
discriminator:
propertyName: objectType
## external-file.yaml :
openapi: 3.0.0
components:
schemas:
simpleObject:
type: object
required:
- objectType
properties:
objectType:
type: string
complexObject:
type: object
required:
- objectType
properties:
objectType:
type: string
And when we try to see the responses object in ReDoc, we have the following error :
I tried to debug it quickly, and I figured out that in this case, the oneOf
variable is empty : https://github.com/Rebilly/ReDoc/blob/master/src/components/Schema/Schema.tsx#L43
Another related issue (I think) : if we remove the discriminator part, it will work but the schemas names are not displayed correctly (object instead of simpleObject for example) :
Please tell me if you need more informations to fix it, thanks !