redoc icon indicating copy to clipboard operation
redoc copied to clipboard

`allOf` schemas that has `if-then` inside do not render properly

Open Orest-Yastremskyy opened this issue 3 years ago • 3 comments

Describe the bug

We are having issues rendering allOf schemas that has if-then inside. We are using redocly versions

"redoc": "2.0.0-rc.73",

"redoc-cli": "^0.13.16",

I am attaching here “layers.schema.current.json” where line 168 consists of a then clause and this json is rendering fine. Our actual schema is as described on “layers.schema.actual.json” and here if you refer to line 168 you will notice an allOf. But this schema fails to render with the current redocly version. Whereas it is as per openAPI standard https://json-schema.org/understanding-json-schema/UnderstandingJSONSchema.pdf (See 4.12.3 If-Then-Else) . allOf schema was working with "redoc": "2.0.0-rc.38".

Note: layers.schema.current.json is called from post_document_operations.schema. I am attaching post_document_operations.schema for debugging help.

Additional context Aforemetioned schemas here: Archive.zip

Front logo Front conversations

Orest-Yastremskyy avatar Aug 26 '22 06:08 Orest-Yastremskyy

Ping from our customer regarding this issue. I'm not rising the priority yet.

Orest-Yastremskyy avatar Sep 28 '22 06:09 Orest-Yastremskyy

I'm also experiencing this issue with Redoc version 2.0.0-rc.77. I've attached the JSON schema from the Understanding JSON Schema-documentation that is referred to in the original message, plus an OAS yaml file that points to the schema using $ref. Below is my report.

Steps to reproduce

  1. Download the attached zip archive: issue-2142.zip. It contains the mentioned JSON schema, a minimal OAS referring to the schema, and a Redoc HTML page.
  2. Deploy the contents of the zip file on a webserver in the same folder.
  3. Load the deployed HTML page (redoc.html) in a webbrowser.

Expected behavior

A tab for each if-then pair within the allOf array containing the global properties plus the properties for each respective pair.

Current behavior

A tab called 'case 1' for the last if-then pair within the allOf array, and a tab called 'case 2' without any properties from the allOf array. If more pairs are added to the array, the result stays the same (two tabs). Below are two screenshots of this behavior.

case 1 image

case2 image

hugovanversendaal avatar Jul 13 '23 12:07 hugovanversendaal

I have also had the experience with this problem. I have tried to generate a minimal example that makes the problem clear. The wrong interpretation occours both when generating an HTML page and when creating a bundle. minimal-example.zip

moftu avatar Dec 13 '23 16:12 moftu