fix: add nullable support and replace silent failures with explicit errors#109
Merged
fix: add nullable support and replace silent failures with explicit errors#109
Conversation
…rrors Nullable/nullish schemas were silently dropped, producing incorrect forms. Seven silent failure patterns replaced with explicit throws so the code generator fails loudly instead of producing partial output. Changes: - unwrap.ts: handle nullable/nullish wrappers, return isNullable flag - introspect.ts: exhaustive switch in buildMetadata, empty enum validation, unknown checks collection, description from outer wrapper - checks.ts: collect unknown Zod checks as warnings - generator.ts: remove try-catch that silently dropped fields - form-wrapper.ts: throw on missing config instead of silent skip - field-components.ts: validate non-empty options for Select/RadioGroup - cli.ts: proper type narrowing, no silent default export fallback 242 tests passing (4 new nullable tests added). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The prior guard already throws if schema is falsy, making the !schema condition always false at the later type validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
z.nullable(),z.nullish(), andz.string().nullable().optional()now correctly unwrap and setisNullableon field descriptors. Previously these crashed or produced wrong output.What changed
unwrap.tsisNullableflagintrospect.tsbuildMetadata, empty enum guard, unknown checks, description from outer wrapperchecks.tsgenerator.tsform-wrapper.tsfield-components.tscli.tstypes.tsisNullabletoFieldDescriptor,warningstoFormDescriptorTest plan
introspect.test.tsGenerated with Claude Code