Redocly / Redocly/redoc

Incorrect Request Body Schema when using both a discriminator and a $ref inside an allOf definition

Open
#945 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

openapi
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

If you look at the "Request body schema", the definition of an unrelated definition sharing the same $ref is shown, but the "Request samples" is correct.
The issue only seems to happen if both a $ref and type using a discriminator are used inside the same "allOf" definition.
Screenshot and sample below:
2019-06-14 15_37_36

redoc_sample.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached redoc_sample.zip and compare the rendered "Request body schema" with the correct "Request samples" output. Trace handling of an allOf definition that combines a discriminator-based type with a $ref; done means the body schema resolves to the intended definition without changing the already-correct request samples.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.