-
-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Description
Problem
When bundling OpenAPI specs, external schemas that contain self-references get inlined, but their internal $ref pointers remain unchanged, creating dangling references that cause composition to fail.
Example
main.yaml:
openapi: 3.1.0
paths:
/tree:
get:
responses:
'200':
content:
application/json:
schema:
$ref: './external.yaml#/components/schemas/Tree'external.yaml:
components:
schemas:
Tree:
type: object
properties:
name:
type: string
children:
type: array
items:
$ref: '#/components/schemas/Tree' # Self-referenceExpected Behavior
The Tree schema should be copied to the root document's components with the self-reference remaining valid (or it should do what was done before, and should be left alone):
components:
schemas:
Tree:
type: object
properties:
name:
type: string
children:
type: array
items:
$ref: '#/components/schemas/Tree' # Still validActual Behavior
The Tree schema body is inlined directly into the response, but the self-reference still points to #/components/schemas/Tree, which doesn't exist in the root document:
paths:
/tree:
get:
responses:
'200':
content:
application/json:
schema:
type: object
properties:
name:
type: string
children:
type: array
items:
$ref: '#/components/schemas/Tree' Calling BundleBytesComposed() fails with:
component `#/components/schemas/Tree` does not exist in the specification
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels