Redocly / Redocly/redoc

Link Item to more object types, example using anyOf / oneOf doesn't work as an example in a child element

Open
#2,204 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Redoc - possibility to link Item to more object types, example using anyOf / oneOf doesnt work as an example in a child element. Redoc example responses does not show the child as expected.

Example response
For the 200 respones Example, I only get one field in the example response. Does not reflect what is in response schema.
redoc3

Response Schema
the response schema ( Which is based on the same code). We get the proper output that i wanted:

redoc2

Expected behavior
Should look like this the example response.

Redoc1

Additional context

PortfolioItemResponseDto: required: - bucketId - description - itemName - itemType type: object properties: riskSafety: type: string nullable: true ... ... ... toObjectLink: type: array items: $ref: '#/components/schemas/ObjectLinkBasic' nullable: true toDecisionPoint: type: array items: $ref: '#/components/schemas/DecisionPointBasic' nullable: true toFinancialPlanning: type: array items: $ref: '#/components/schemas/FinancialPlanningBasic' nullable: true additionalProperties: false

ObjectLinkBasic: required: - itemGuid - objectType type: object properties: objectType: type: string example: String nullable: true itemGuid: type: string example: 000d3ac2-4d73-1eeb-b1a5-438f3f492902 nullable: true oneOf: - $ref: '#/components/schemas/ThelmaLink' - $ref: '#/components/schemas/ProjectLink' - $ref: '#/components/schemas/MaintenanceRecordLink' additionalProperties: false

ThelmaLink: properties: thelmaId: type: string nullable: true ProjectLink: properties: projectId: type: string nullable: true MaintenanceRecordLink: properties: maintenanceRecordId: type: string nullable: true

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

The issue identifies no source files or tests. Reproduce the response example from the supplied PortfolioItemResponseDto and ObjectLinkBasic oneOf schemas, then trace the example-rendering entry point; done means the child fields are represented in the generated example as expected.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.