Refactor rendering logic to ensure DRY code and consistent generation#22
Open
aram-wealthmore wants to merge 1 commit into
Open
Refactor rendering logic to ensure DRY code and consistent generation#22aram-wealthmore wants to merge 1 commit into
aram-wealthmore wants to merge 1 commit into
Conversation
Refactor the rendering logic to ensure DRY code and consistent generation of TypeScript interfaces and Zod schemas. * **generator.ts** - Refactor to use `generateInterfaceFileInline` and `generateZodSchemaFileInline` for rendering models, inputs, outputs, enums, and args. - Remove redundant logic and use shared utilities. * **libs/renderers/interfaceRenderer.ts** - Add a new file to handle rendering of TypeScript interfaces. - Use shared utility functions for generating interfaces. - Integrate `InlineContext` for managing context. * **libs/renderers/zodSchemaRenderer.ts** - Add a new file to handle rendering of Zod schemas. - Use shared utility functions for generating Zod schemas. - Integrate `InlineContext` for managing context. * **libs/renderers/enumRenderer.ts** - Use shared utility functions for generating enums. - Integrate `InlineContext` for managing context. * **libs/utils/camelCase.ts** - Add `toCamelCase` function for consistent naming conventions. * **libs/utils/buildUnionType.ts** - Simplify logic for handling union types. * **Delete files** - Remove `libs/renderers/complexTypeRenderer.ts` and `libs/renderers/modelRenderer.ts`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/aram-devdocs/prisma-dto-gen?shareId=XXXX-XXXX-XXXX-XXXX).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the rendering logic to ensure DRY code and consistent generation of TypeScript interfaces and Zod schemas.
generator.ts
generateInterfaceFileInlineandgenerateZodSchemaFileInlinefor rendering models, inputs, outputs, enums, and args.libs/renderers/interfaceRenderer.ts
InlineContextfor managing context.libs/renderers/zodSchemaRenderer.ts
InlineContextfor managing context.libs/renderers/enumRenderer.ts
InlineContextfor managing context.libs/utils/camelCase.ts
toCamelCasefunction for consistent naming conventions.libs/utils/buildUnionType.ts
Delete files
libs/renderers/complexTypeRenderer.tsandlibs/renderers/modelRenderer.ts.For more details, open the Copilot Workspace session.