Skip to content

Commit

Permalink
feat: reduce dependency count threshold for a type to be imported fro…
Browse files Browse the repository at this point in the history
…m common file to just 1
  • Loading branch information
imballinst authored and astahmer committed Jul 25, 2023
1 parent 4254b72 commit e23b42d
Show file tree
Hide file tree
Showing 3 changed files with 604 additions and 126 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-hotels-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-zod-client": minor
---

feat: reduce dependency count threshold for a type to be imported from common file to just 1
2 changes: 1 addition & 1 deletion lib/src/template-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const getZodClientTemplateContext = (
const groupTypes = {} as Record<string, string>;
Object.entries(group.schemas).forEach(([name, schema]) => {
const count = dependenciesCount.get(name) ?? 0;
if (count > 1) {
if (count >= 1) {
group.imports![name] = "common";
commonSchemaNames.add(name);
} else {
Expand Down
Loading

1 comment on commit e23b42d

@vercel
Copy link

@vercel vercel bot commented on e23b42d Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.