Discriminator property disappears from example when mapping is added
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023
08:07 AM
01-05-2023
08:07 AM
Discriminator property disappears from example when mapping is added
Hi, I'm trying to get the discriminator property to show up in examples when using oneOf, but it disappears when I add a custom mapping under discriminator in the object that has the oneOf.
This is what the document looks like
Spoiler
openapi: 3.0.3
info:
title: ''
version: 0.0.0
paths:
/test/:
post:
operationId: test_create
tags:
- events
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TestPolymorphic'
responses:
'200':
description: ''
components:
schemas:
Test1:
type: object
properties:
prop1:
type: string
type:
type: string
required:
- prop1
- type
Test2:
type: object
properties:
prop2:
type: string
type:
type: string
required:
- prop2
- type
TestPolymorphic:
oneOf:
- $ref: '#/components/schemas/Test2'
- $ref: '#/components/schemas/Test1'
discriminator:
propertyName: type
mapping:
Test2: '#/components/schemas/Test2'
Test1: '#/components/schemas/Test1'
Labels:
- Labels:
-
Swagger UI
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023
02:37 AM
01-06-2023
02:37 AM
hi @Numerlor ,
That appears to be a bug on SwaggerUI, feel free to log a bug there... https://github.com/swagger-api/swagger-ui/issues/new
