@asyncapi/converter 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/third-version.js +1 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +5 -1
- package/package.json +1 -1
package/lib/third-version.js
CHANGED
|
@@ -222,7 +222,7 @@ function applyMessageRefsToOperation(serializedMessages, newMessagePath, operati
|
|
|
222
222
|
if (Object.keys(serializedMessages !== null && serializedMessages !== void 0 ? serializedMessages : {}).length > 0) {
|
|
223
223
|
const newOperationMessages = [];
|
|
224
224
|
Object.entries(serializedMessages).forEach(([messageId, messageValue]) => {
|
|
225
|
-
if ((0, utils_1.
|
|
225
|
+
if ((0, utils_1.isRemoteRef)(messageValue)) {
|
|
226
226
|
// shallow copy of JS reference
|
|
227
227
|
newOperationMessages.push(Object.assign({}, messageValue));
|
|
228
228
|
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare function createRefObject(...paths: Array<string | number>): {
|
|
|
16
16
|
};
|
|
17
17
|
export declare function createRefPath(...paths: Array<string | number>): string;
|
|
18
18
|
export declare function isRefObject(value: unknown): boolean;
|
|
19
|
+
export declare function isRemoteRef(value: any): boolean;
|
|
19
20
|
export declare function getValueByRef(root: any, ref: string): any;
|
|
20
21
|
export declare function getValueByPath(value: any, path: string[]): any;
|
|
21
22
|
export declare function sortObjectKeys(obj: any, keys: string[]): any;
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortObjectKeys = exports.getValueByPath = exports.getValueByRef = exports.isRefObject = exports.createRefPath = exports.createRefObject = exports.isPlainObject = exports.dotsToSlashes = exports.objectToSchema = exports.serializeInput = void 0;
|
|
3
|
+
exports.sortObjectKeys = exports.getValueByPath = exports.getValueByRef = exports.isRemoteRef = exports.isRefObject = exports.createRefPath = exports.createRefObject = exports.isPlainObject = exports.dotsToSlashes = exports.objectToSchema = exports.serializeInput = void 0;
|
|
4
4
|
const js_yaml_1 = require("js-yaml");
|
|
5
5
|
function serializeInput(document) {
|
|
6
6
|
let triedConvertToYaml = false;
|
|
@@ -69,6 +69,10 @@ function isRefObject(value) {
|
|
|
69
69
|
return Boolean(value && '$ref' in value);
|
|
70
70
|
}
|
|
71
71
|
exports.isRefObject = isRefObject;
|
|
72
|
+
function isRemoteRef(value) {
|
|
73
|
+
return isRefObject(value) && !value.$ref.startsWith('#');
|
|
74
|
+
}
|
|
75
|
+
exports.isRemoteRef = isRemoteRef;
|
|
72
76
|
function getValueByRef(root, ref) {
|
|
73
77
|
if (!ref.startsWith('#')) {
|
|
74
78
|
return;
|