You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(typebox): improve handling of large union types (#24)
This commit introduces a new feature to handle large union types more efficiently in the TypeBox schema codegen.
The key changes are:
- Introduce a `shouldChunkUnion` function to check if a union type has more than a certain number of members (20 in this case).
- Implement the `createChunkNodes` function to split large union types into smaller "chunk" types, each containing a subset of the original union members.
- Update the `addLocalTypes` function in `local-type-collector.ts` to detect large unions and create the corresponding chunk types.
- The chunk types are added to the `NodeGraph` and `ResolverStore` to be processed by the schema codegen.
This change improves the performance and memory usage of the schema codegen when dealing with large union types, which can be common in complex validation schemas.
0 commit comments