Repository navigation
Description
Since upgrading from RapiDoc 9.3.8 to 11.0.1, deeply nested response schemas are no longer rendered completely. Beyond a fixed nesting depth, properties are shown as empty objects ({ }) instead of their actual type (e.g. id: { } instead of id: integer).
The limit appears to be hard-coded in v11.0.1:
- https://github.com/rapi-doc/RapiDoc/blob/v11.0.1/packages/rapidoc/src/utils/schema-utils.js#L1249-L1259
- https://github.com/rapi-doc/RapiDoc/blob/v11.0.1/packages/rapidoc/src/utils/schema-utils.js#L696
- https://github.com/rapi-doc/RapiDoc/blob/v11.0.1/packages/rapidoc/src/utils/schema-utils.js#L1477
Why this matters
Depth 9 is reached quickly in realistic APIs without any recursion.
Example: response allOf (pagination + data) → data → items allOf (model + includes) → include → organization allOf (model + nested include) → location → Location allOf (base model + attributes) → id, city (level 9 → truncated)
The only workaround is restructuring the spec to avoid allOf levels. That is not always possible without duplicating schemas, and it makes the spec harder to maintain only to satisfy the renderer.
Minimal reproduction
openapi: 3.1.0
info:
title: Depth limit reproduction
version: 1.0.0
paths:
/events:
get:
responses:
'200':
description: paginated list of events
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Pagination'
- type: object
properties:
data:
type: array
items:
allOf:
- $ref: '#/components/schemas/Event'
- $ref: '#/components/schemas/IncludeOrganization'
components:
schemas:
Base:
type: object
properties:
id:
type: integer
Pagination:
type: object
properties:
total:
type: integer
Event:
allOf:
- $ref: '#/components/schemas/Base'
- type: object
properties:
name:
type: string
Organization:
allOf:
- $ref: '#/components/schemas/Base'
- type: object
properties:
name:
type: string
Location:
allOf:
- $ref: '#/components/schemas/Base'
- type: object
properties:
city:
type: string
IncludeOrganization:
type: object
properties:
organization:
allOf:
- $ref: '#/components/schemas/Organization'
- type: object
properties:
location:
$ref: '#/components/schemas/Location'Expected (as in 9.3.8):
location: {
id: integer
city: string
}
Actual (11.0.1):
location: {
id: { }
city: { }
}
Proposal
Any of the following would solve the issue:
- Make the depth limit configurable, e.g. via a new attribute
schema-max-depth(default8to keep the current behaviour). - Only truncate real recursion: stop at schemas that are already being expanded on the current path (cycle detection) instead of at a fixed depth.
- Don't count
allOfcomposition as a nesting level, because mergingallOfsubschemas does not add a level of nesting in the JSON.
Option 2 would be the most robust, because it prevents infinite recursion without cutting off legitimate deep schemas.
Activity
fix(rapidoc): count only JSON nesting toward the schema depth limit