Skip to content

Commit 4d0e7e2

Browse files
committed
only ignore refs when theyre in text, like in stringified openapi specs
1 parent d13bade commit 4d0e7e2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/core/src/implementations/default_variable_substitutor.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@ export class DefaultVariableSubstitutor implements VariableSubstitutor {
7777
throw new Error(`Variable namespace '${namespace}' contains invalid characters. Only alphanumeric characters and underscores are allowed.`);
7878
}
7979

80-
const objString = JSON.stringify(obj);
81-
if (objString && objString.includes('$ref')) {
82-
return obj;
83-
}
84-
8580
if (typeof obj === 'string') {
81+
if (obj.includes('$ref')) {
82+
return obj;
83+
}
8684
let currentString: string = obj;
8785
const regex = /\$\{([a-zA-Z0-9_]+)\}|\$([a-zA-Z0-9_]+)/g;
8886
let match: RegExpExecArray | null;
@@ -147,6 +145,10 @@ export class DefaultVariableSubstitutor implements VariableSubstitutor {
147145
const regex = /\$\{([a-zA-Z0-9_]+)\}|\$([a-zA-Z0-9_]+)/g;
148146

149147
if (typeof obj === 'string') {
148+
if (obj.includes('$ref')) {
149+
return [];
150+
}
151+
150152
let match;
151153
while ((match = regex.exec(obj)) !== null) {
152154
const varNameInTemplate = match[1] || match[2];

0 commit comments

Comments
 (0)