Skip to content

Commit 589e4cb

Browse files
authoredMar 14, 2025··
[deduplication] Only treat "$ref" as reference if value is string (#5088)
- Fixes #5028
1 parent 80d9306 commit 589e4cb

File tree

7 files changed

+45
-7
lines changed

7 files changed

+45
-7
lines changed
 

‎packages/extensions/core/CHANGELOG.json

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"name": "@autorest/core",
33
"entries": [
4+
{
5+
"version": "3.10.4",
6+
"tag": "@autorest/core_v3.10.4",
7+
"date": "Fri, 14 Mar 2025 16:49:52 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "[deduplication] Only treat \"$ref\" as reference if value is string"
12+
}
13+
]
14+
}
15+
},
416
{
517
"version": "3.10.3",
618
"tag": "@autorest/core_v3.10.3",

‎packages/extensions/core/CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log - @autorest/core
22

3-
This log was last generated on Thu, 31 Oct 2024 00:11:17 GMT and should not be manually modified.
3+
This log was last generated on Fri, 14 Mar 2025 16:49:52 GMT and should not be manually modified.
4+
5+
## 3.10.4
6+
Fri, 14 Mar 2025 16:49:52 GMT
7+
8+
### Patches
9+
10+
- [deduplication] Only treat "$ref" as reference if value is string
411

512
## 3.10.3
613
Thu, 31 Oct 2024 00:11:17 GMT

‎packages/extensions/core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@autorest/core",
3-
"version": "3.10.3",
3+
"version": "3.10.4",
44
"description": "AutoRest Core Module",
55
"engines": {
66
"node": ">=12.0.0"
@@ -49,7 +49,7 @@
4949
"@azure-tools/async-io": "~3.0.0",
5050
"@azure-tools/codegen": "~2.10.0",
5151
"@azure-tools/datastore": "~4.8.0",
52-
"@azure-tools/deduplication": "~3.2.1",
52+
"@azure-tools/deduplication": "~3.2.2",
5353
"@azure-tools/extension": "~3.7.1",
5454
"@azure-tools/json": "~1.3.0",
5555
"@azure-tools/jsonschema": "~1.3.0",

‎packages/libs/deduplication/CHANGELOG.json

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"name": "@azure-tools/deduplication",
33
"entries": [
4+
{
5+
"version": "3.2.2",
6+
"tag": "@azure-tools/deduplication_v3.2.2",
7+
"date": "Fri, 14 Mar 2025 06:11:23 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Only treat \"$ref\" as reference if value is string"
12+
}
13+
]
14+
}
15+
},
416
{
517
"version": "3.2.1",
618
"tag": "@azure-tools/deduplication_v3.2.1",

‎packages/libs/deduplication/CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log - @azure-tools/deduplication
22

3-
This log was last generated on Wed, 28 Feb 2024 18:02:21 GMT and should not be manually modified.
3+
This log was last generated on Fri, 14 Mar 2025 06:11:23 GMT and should not be manually modified.
4+
5+
## 3.2.2
6+
Fri, 14 Mar 2025 06:11:23 GMT
7+
8+
### Patches
9+
10+
- Only treat "$ref" as reference if value is string
411

512
## 3.2.1
613
Wed, 28 Feb 2024 18:02:21 GMT

‎packages/libs/deduplication/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure-tools/deduplication",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "Deduplication of elements in OpenAPI 3 documents",
55
"main": "./dist/main.js",
66
"typings": "./dist/main.d.ts",

‎packages/libs/deduplication/src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ export class Deduplicator {
400400
continue;
401401
}
402402

403-
if (key === "$ref") {
403+
if (key === "$ref" && typeof value === "string") {
404404
const refParts = value.split("/");
405405
const componentUid = refParts.pop();
406406
const type = refParts.pop();
407-
await this.deduplicateComponent(componentUid, type);
407+
await this.deduplicateComponent(componentUid!, type!);
408408
} else if (value && typeof value === "object") {
409409
await this.crawlObject(value);
410410
}

0 commit comments

Comments
 (0)
Please sign in to comment.