Redocly / Redocly/redoc

Response samples lists sub-types when base-type has a discriminator.

Open
#1,336 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Basically I have a base type and sub-types.
Whenever I try to refer to sub-type then in the doc it gives all the sub-types of base-type.
For example:
In this patch of code, I am using TestingFolderResponse (sub-type) for the response.
testGetRoot

And the TestingFolderResponse and TestingParserResponse sub-types looks like this:
Folder_Parser_Test_Model

And my base-type looks like:
BaseTestModel

In docs, instead of just listing TestingFolderResponse properties, it is giving an option between TestingFolderResponse and TestingParserResponse as shown instead of just listing TestingFolderResponse

Screen Shot 2020-07-31 at 12 51 09 PM

Not sure if this is the expected behaviour.
But according to me, sub-types shouldn’t know about base-type. This happens only when I add a discriminator in my base-type. Can someone help me with this?
And also, is there a workaround to fix this issue?

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

No files, tests, or entry points are named. Start by reproducing the response documentation with TestingFolderResponse and TestingParserResponse inheriting from a discriminated base type, then verify that the rendered response lists only TestingFolderResponse rather than both sub-types.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.