Current Behavior
adc convert openapi fails with RangeError: Maximum call stack size exceeded when converting an OpenAPI 3.0.2 document that contains a self-referencing schema.
This appears to be the same class of issue as #350, but it is still reproducible with ADC 0.26.0.
Expected Behavior
OpenAPI 3.0.x documents with circular or self-referencing component schemas should convert successfully, especially because the ADC output only needs route/service metadata and does not need to fully expand response schemas.
Steps to Reproduce
Save the following as repro.yaml:
openapi: 3.0.2
info:
title: SectorAPI
version: 3.0.0
servers:
- url: http://localhost:8080
paths:
/v3/sectors:
get:
operationId: getSectors
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Section"
components:
schemas:
Sector:
type: object
properties:
key:
type: string
description:
type: string
SectorNode:
type: object
properties:
sector:
$ref: "#/components/schemas/Sector"
children:
type: array
items:
$ref: "#/components/schemas/SectorNode"
Section:
type: object
properties:
key:
type: string
description:
type: string
sectorNodes:
type: array
items:
$ref: "#/components/schemas/SectorNode"
Run:
adc convert openapi --verbose 0 -f repro.yaml -o apisix-api.yml
Actual Output
[ADC] › ✖ fatal RangeError: Maximum call stack size exceeded
Environment
- ADC version: 0.26.0
- OpenAPI version: 3.0.2
Additional Context
The self-reference is SectorNode.children.items -> SectorNode. The converter currently calls dereference(content) before validating/converting the OpenAPI document, so this may still be related to how circular refs are dereferenced or traversed.
Related issue: #350
Current Behavior
adc convert openapifails withRangeError: Maximum call stack size exceededwhen converting an OpenAPI 3.0.2 document that contains a self-referencing schema.This appears to be the same class of issue as #350, but it is still reproducible with ADC 0.26.0.
Expected Behavior
OpenAPI 3.0.x documents with circular or self-referencing component schemas should convert successfully, especially because the ADC output only needs route/service metadata and does not need to fully expand response schemas.
Steps to Reproduce
Save the following as
repro.yaml:Run:
Actual Output
Environment
Additional Context
The self-reference is
SectorNode.children.items -> SectorNode. The converter currently callsdereference(content)before validating/converting the OpenAPI document, so this may still be related to how circular refs are dereferenced or traversed.Related issue: #350