redoc: False positive recursion
Hello there, wrestling following issue.
Imagine I want to reuse some schema, let’s say ID – I have following in ./helpers/id.yaml:
properties:
id:
type: number
required:
- id
And here is a simple OpenAPI, which should result in a simple structure of three nested objects, which all wants to reference the id helper.
openapi: 3.0.0
info:
title: False positive recursion
version: '3.0'
paths:
/documents:
get:
summary: Example
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: ./helpers/id.yaml
- properties:
second:
allOf:
- $ref: ./helpers/id.yaml
- properties:
third:
allOf:
- $ref: ./helpers/id.yaml
- properties:
something:
type: string
Whereas the first and second object are correctly rendered with required id attribute, the third object is flagged as recursive:

Any idea? Is it a bug or am I missing something?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 15
- Comments: 22 (6 by maintainers)
Commits related to this issue
- Fix #1154 Immediately exit from allOf's children, but use separate refCounter to do not enter into same scheme recursively Also add pseudo-recursive example — committed to m0003r/redoc by m0003r 4 years ago
- Fix #1154 Immediately exit from allOf's children, but use separate refCounter to do not enter into same scheme recursively Also add pseudo-recursive example — committed to jlaw90/redoc by m0003r 4 years ago
Short update on this ages-old issue 🙈. I found some time to work on this and looks like I have a solution. I need some time to clean it up and add tests. Thank you all for your examples here, it will definitely help with the test cases 💙.
Same here. Problem still exists
Any updates on this issue? I’m also still struggling with this
It is a bug. I will investigate it when I have time
This is the simplest reproduction code:
It works fine if you inline
Ain one of the referencesFor me issue still persists with the latest version
Also encountering this issue. Example very similar to original poster’s, but in my case
Recursiveis being rendered on the 2nd level repeated nested object being included withallOf, and not the 3rd.I tried it whith the latest version 0.10.1 and there is still the problem
Looks like this might not be a problem anymore with the latest version of
redoc-cli🤷OK, I don’t understand, but it seems all right now. Maybe some cache. Sorry… Thanks for the fix!
Please, provide steps to reproduce. It works for me.
I’m running into this issue as well using a schema with the below structure. ReDoc will correctly display the
TopLevelSchema, but tags thesubobjectsarray as recursive.My dependencies are currently using the following versions:
The issue is present when the docs are presented using both
openapi-cli preview-docsandredoc-cli serve. Below is a minimal example OpenAPI 3 document which demonstrates the issue.@remnestal I just rebased the commit from #1186 to see if it fixed the problem for us but it didn’t - I haven’t had time to investigate further unfortunately