Skip to content

Commit ee5ea95

Browse files
committed
chore: fix lint formatting
fix: prevent infinite recursion for circular tuple array schemas
1 parent 134a3f9 commit ee5ea95

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

src/processors/AsyncAPIInputProcessor.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,6 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor {
201201
if (typeof schema === 'boolean') {
202202
return schema;
203203
}
204-
205-
if (typeof schema === 'object') {
206-
if (visitedSchemas.has(schema)) {
207-
return {};
208-
}
209-
visitedSchemas.add(schema);
210-
}
211-
212204
let schemaUid = schema.id();
213205
//Because the constraint functionality of generators cannot handle -, <, >, we remove them from the id if it's an anonymous schema.
214206
if (
@@ -233,21 +225,33 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor {
233225
convertedSchema.allOf = schema
234226
.allOf()!
235227
.map((item: any) =>
236-
this.convertToInternalSchema(item, alreadyIteratedSchemas, visitedSchemas)
228+
this.convertToInternalSchema(
229+
item,
230+
alreadyIteratedSchemas,
231+
visitedSchemas
232+
)
237233
);
238234
}
239235
if (schema.oneOf()) {
240236
convertedSchema.oneOf = schema
241237
.oneOf()!
242238
.map((item: any) =>
243-
this.convertToInternalSchema(item, alreadyIteratedSchemas, visitedSchemas)
239+
this.convertToInternalSchema(
240+
item,
241+
alreadyIteratedSchemas,
242+
visitedSchemas
243+
)
244244
);
245245
}
246246
if (schema.anyOf()) {
247247
convertedSchema.anyOf = schema
248248
.anyOf()!
249249
.map((item: any) =>
250-
this.convertToInternalSchema(item, alreadyIteratedSchemas, visitedSchemas)
250+
this.convertToInternalSchema(
251+
item,
252+
alreadyIteratedSchemas,
253+
visitedSchemas
254+
)
251255
);
252256
}
253257
if (schema.not()) {
@@ -317,7 +321,12 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor {
317321
convertedSchema.items = (
318322
schema.items() as AsyncAPISchemaInterface[]
319323
).map(
320-
(item) => this.convertToInternalSchema(item, alreadyIteratedSchemas, visitedSchemas),
324+
(item) =>
325+
this.convertToInternalSchema(
326+
item,
327+
alreadyIteratedSchemas,
328+
visitedSchemas
329+
),
321330
alreadyIteratedSchemas
322331
);
323332
} else {
@@ -376,7 +385,11 @@ export class AsyncAPIInputProcessor extends AbstractInputProcessor {
376385
schemaPatternProperties
377386
)) {
378387
patternProperties[String(patternPropertyName)] =
379-
this.convertToInternalSchema(patternProperty, alreadyIteratedSchemas, visitedSchemas);
388+
this.convertToInternalSchema(
389+
patternProperty,
390+
alreadyIteratedSchemas,
391+
visitedSchemas
392+
);
380393
}
381394
convertedSchema.patternProperties = patternProperties;
382395
}

0 commit comments

Comments
 (0)