Skip to content

Commit ed9b2d4

Browse files
authored
fix: resolve sibling refs alongside $ref (#2362)
1 parent 79b61a5 commit ed9b2d4

File tree

22 files changed

+471
-0
lines changed

22 files changed

+471
-0
lines changed

.changeset/smart-points-pull.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@redocly/openapi-core": patch
3+
---
4+
5+
Fixed an issue where references were not resolved when used inside other properties alongside the `$ref` keyword.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
asyncapi: '3.0.0'
2+
info:
3+
title: Account Service
4+
version: 1.0.0
5+
components:
6+
schemas:
7+
Parent:
8+
type: object
9+
properties:
10+
field:
11+
description:
12+
$ref: './description.md'
13+
$ref: '#/components/schemas/Child'
14+
Child:
15+
type: object
16+
properties:
17+
name:
18+
type: string
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a description resolved from a reference file.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apis:
2+
main:
3+
root: ./asyncapi.yaml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
info:
2+
title: Account Service
3+
version: 1.0.0
4+
components:
5+
schemas:
6+
Parent:
7+
type: object
8+
properties:
9+
field:
10+
description: |
11+
This is a description resolved from a reference file.
12+
$ref: '#/components/schemas/Child'
13+
Child:
14+
type: object
15+
properties:
16+
name:
17+
type: string
18+
asyncapi: 3.0.0
19+
20+
bundling asyncapi.yaml using configuration for api 'main'...
21+
📦 Created a bundle for asyncapi.yaml at stdout <test>ms.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Summary from reference
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a description resolved from a reference file.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Inline Test
4+
version: 1.0.0
5+
paths:
6+
/test:
7+
get:
8+
responses:
9+
'200':
10+
content:
11+
application/json:
12+
schema:
13+
type: object
14+
properties:
15+
field:
16+
description:
17+
$ref: './description.md'
18+
summary:
19+
$ref: './summary.md'
20+
$ref: '#/components/schemas/Child'
21+
components:
22+
schemas:
23+
Child:
24+
type: object
25+
description: 'should not win'
26+
properties:
27+
name:
28+
type: string
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apis:
2+
main:
3+
root: ./openapi.yaml
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Inline Test
4+
version: 1.0.0
5+
paths:
6+
/test:
7+
get:
8+
responses:
9+
'200':
10+
content:
11+
application/json:
12+
schema:
13+
type: object
14+
properties:
15+
field:
16+
description: |
17+
This is a description resolved from a reference file.
18+
summary: |
19+
Summary from reference
20+
$ref: '#/components/schemas/Child'
21+
components:
22+
schemas:
23+
Child:
24+
type: object
25+
description: should not win
26+
properties:
27+
name:
28+
type: string
29+
30+
bundling openapi.yaml using configuration for api 'main'...
31+
📦 Created a bundle for openapi.yaml at stdout <test>ms.

0 commit comments

Comments
 (0)