Skip to content

Commit e744e29

Browse files
committed
fix(transformers): use symbol for additionalProperties key variable
1 parent 574d4d3 commit e744e29

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • packages/openapi-ts/src/plugins/@hey-api/transformers

packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,17 @@ function processSchemaType({
195195
}
196196

197197
if (schema.additionalProperties && dataExpression) {
198+
const key = plugin.symbol('key');
198199
const entryValueNodes = processSchemaType({
199-
dataExpression: $(dataExpression).attr('key').computed(),
200+
dataExpression: $(dataExpression).attr(key).computed(),
200201
plugin,
201202
schema: schema.additionalProperties,
202203
});
203204

204205
if (entryValueNodes.length) {
205206
const properties = Object.keys(schema.properties ?? {});
206207
nodes.push(
207-
$.for($.const('key'))
208+
$.for($.const(key))
208209
.of($('Object').attr('keys').call(dataExpression))
209210
.$if(
210211
properties.length,
@@ -214,7 +215,7 @@ function processSchemaType({
214215
$.not(
215216
$.array(...properties)
216217
.attr('includes')
217-
.call('key'),
218+
.call(key),
218219
),
219220
).do(...entryValueNodes),
220221
),

0 commit comments

Comments
 (0)