Skip to content

Commit

Permalink
de-duplicate children (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz authored Jun 23, 2019
1 parent e38afc5 commit c2dd9af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CircularReferenceTypeFormatter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Definition } from "./Schema/Definition";
import { SubTypeFormatter } from "./SubTypeFormatter";
import { BaseType } from "./Type/BaseType";
import { uniqueArray } from "./Utils/uniqueArray";

export class CircularReferenceTypeFormatter implements SubTypeFormatter {
private definition = new Map<BaseType, Definition>();
Expand Down Expand Up @@ -31,7 +32,7 @@ export class CircularReferenceTypeFormatter implements SubTypeFormatter {

const children: BaseType[] = [];
this.children.set(type, children);
children.push(...this.childTypeFormatter.getChildren(type));
children.push(...uniqueArray(this.childTypeFormatter.getChildren(type)));
return children;
}
}

0 comments on commit c2dd9af

Please sign in to comment.