Feature implementation from commits 89b41b5..494583f#4
Feature implementation from commits 89b41b5..494583f#4codeOwlAI wants to merge 15 commits intofeature-base-branch-2from
Conversation
according to SEMVER spec, this must be a minor update: > Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backward compatible functionality is introduced to the public API.
|
|
||
| const ctx: ConversionTypeContext = { resolver, zodSchemaByName: {}, schemaByName: {} }; | ||
| if (options?.exportAllNamedSchemas) { | ||
| ctx.schemasByName = {}; |
There was a problem hiding this comment.
🐛 Correctness Issue
Property name mismatch with type definition.
The code initializes ctx.schemasByName but the type definition uses schemaByName (without 's'), which will cause runtime errors when accessing this property.
Current Code (Diff):
- ctx.schemasByName = {};
+ ctx.schemaByName = {};📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
| ctx.schemasByName = {}; | |
| ctx.schemaByName = {}; |
🔄 Dependencies Affected
lib/src/template-context.ts
Function: any function using getZodiosEndpointDefinitionList result
Issue: Code expecting schemaByName property but receiving schemasByName
Suggestion: Update any code using ctx.schemasByName to use ctx.schemaByName instead
| dependencies.add(schemaName); | ||
| // Sometimes the schema includes a chain that should be removed from the dependency | ||
| const [normalizedSchemaName] = schemaName.split("."); | ||
| dependencies.add(normalizedSchemaName!); |
There was a problem hiding this comment.
🐛 Correctness Issue
Non-null Assertion on Potentially Undefined Value.
The non-null assertion operator on normalizedSchemaName could cause runtime errors if the split pattern produces unexpected results.
Current Code (Diff):
- dependencies.add(normalizedSchemaName!);
+ dependencies.add(normalizedSchemaName || schemaName);📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
| dependencies.add(normalizedSchemaName!); | |
| dependencies.add(normalizedSchemaName || schemaName); |
PR Summary
Schema Refinement Feature and Schema Handling Improvements
Overview
This PR adds schema refinement capabilities, improves schema name handling for duplicates, and fixes issues with falsy default values and string trimming.
Change Types
Affected Modules
src/openApiToZod.tssrc/template-context.tssrc/getZodiosEndpointDefinitionList.tstests/*Notes for Reviewers