Skip to content

feat: add null option and rewrite README#23

Merged
fahchen merged 5 commits intomainfrom
feat/null-option-and-readme
Mar 7, 2026
Merged

feat: add null option and rewrite README#23
fahchen merged 5 commits intomainfrom
feat/null-option-and-readme

Conversation

@fahchen
Copy link
Member

@fahchen fahchen commented Dec 21, 2025

Summary

  • Add null option for field types to control nullability explicitly
  • Rewrite README for clarity and conversational tone

Changes

New null option

Fields can now use null: false to prevent nil from being added to their type, or null: true (default) to allow it. This is useful for database records where some fields are always present (like id, inserted_at).

typed_structor do
  field :id, integer(), null: false       # Never nil
  field :name, String.t(), null: true     # Always nullable
end

The option can also be set at the module level:

typed_structor null: false do
  field :id, integer()                    # Not nullable by default
  field :phone, String.t(), null: true    # Override for this field
end

README rewrite

  • Added "Why TypedStructor?" section with before/after comparison
  • Reorganized content into logical sections (Getting Started, Options, Common Patterns, Advanced Features)
  • Made examples more practical and self-contained
  • Improved formatting with callouts and tables

Changelog

- feat: add null option for field types
- docs: rewrite README for clarity and conversational tone

Copilot AI review requested due to automatic review settings December 21, 2025 14:28

This comment was marked as outdated.

This comment was marked as resolved.

fahchen and others added 3 commits December 22, 2025 00:08
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
@fahchen fahchen force-pushed the feat/null-option-and-readme branch from 1d91b95 to 0835f60 Compare December 21, 2025 15:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fahchen fahchen merged commit f673f6e into main Mar 7, 2026
5 checks passed
@fahchen fahchen deleted the feat/null-option-and-readme branch March 7, 2026 05:20
fahchen added a commit that referenced this pull request Mar 7, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.6.0](v0.5.0...v0.6.0)
(2026-03-07)


### Features

* add null option and rewrite README
([#23](#23))
([f673f6e](f673f6e))


### Bug Fixes

* typos
([cf89ffd](cf89ffd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Phil Chen <06fahchen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants