Open
Conversation
Restructure README to show value upfront with before/after comparison, add behavior table for enforce/default/null interaction, and improve overall readability while maintaining technical accuracy.
- Remove duplicate 'Parameterized Types' section (already covered in 'Type Parameters') - Remove duplicate 'Custom Types' section (already covered in 'Opaque Types') - Fix @moduledoc placement in Documentation example (should be at module level) - Rename test to accurately describe what it tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Clarify that null: true is the default behavior - Condense option tables from 8 rows to 4 using "-" for irrelevant values - Use consistent column order (default, enforce, null) across tables - Improve wording for "Providing Defaults" section
1d91b95 to
0835f60
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/null_option_test.exs
Outdated
| field :email, String.t(), enforce: true | ||
| end | ||
| after | ||
| # Struct can be created with nil for nullable fields |
There was a problem hiding this comment.
This comment could be misleading. The test demonstrates that fields can be nil at runtime even with null: false (line 47), not just "nullable fields". Consider revising to clarify that the null option only affects the type specification, not runtime behavior. For example: "Fields can hold nil at runtime regardless of null option".
Suggested change
| # Struct can be created with nil for nullable fields | |
| # Struct fields can be nil at runtime regardless of null option in the type spec |
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
nulloption for field types to control nullability explicitlyChanges
New
nulloptionFields can now use
null: falseto preventnilfrom being added to their type, ornull: true(default) to allow it. This is useful for database records where some fields are always present (likeid,inserted_at).The option can also be set at the module level:
README rewrite
Changelog