OpenAPI 3 with discriminator & mapping fields
Open
Nobody has claimed this yet.
openapi
- Dominant language
- TypeScript
- Stars
- 25.9k
- Forks
- 2.4k
- Avg merge
- 13h 10m
- Merged PRs (30d)
- 4
Description
Hi,
Firstly, congratulations for your tool. It is really the best viewer that I could have used!
From redoc v2.0.0-rc.18, I have a problem with discriminator & mapping fields of OpenAPI 3
Indeed, below, we can see my screenshot from the following specs file:
openapi: 3.0.0
########## INFO ##########
info:
title: Test
description: Specifications of test bounded context
version: 1.0.0
paths:
/pet:
put:
tags:
- Pet
description: Test
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: Capture that has to be applied to transaction
responses:
"200":
description: The transaction captured.
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
components:
schemas:
Pet:
type: object
required:
- pet_type
properties:
pet_type:
type: string
discriminator:
propertyName: pet_type
mapping:
dog: "Dog"
cat: "Cat"
lizard: "Lizard"
Dog:
allOf:
- $ref: "#/components/schemas/Pet"
- type: object
# all other properties specific to a `Dog`
properties:
bark:
type: string
Cat:
allOf:
- $ref: "#/components/schemas/Pet"
- type: object
# all other properties specific to a `Cat`
properties:
name:
type: string
Lizard:
allOf:
- $ref: "#/components/schemas/Pet"
- type: object
# all other properties specific to a `Lizard`
properties:
lovesRocks:
type: boolean
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides an OpenAPI 3 schema example and a screenshot, but names no repository file, test, or entry point. Reproduce the example in the Redoc viewer and investigate how discriminator and mapping fields are rendered; done should be defined by the expected rendering, which the issue does not specify.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100