Refactor Type validators to use zero-allocation static methods#323
Merged
Conversation
- Replace Type.new(...).check with static Type.check class method - Replace Types.new(...).validate! with static Types.validate method - Return nil on success, Hash on failure (zero allocation happy path) - Add compute_prepared_value as private class method - Add build_errors_from to construct errors from validation data - Update related validation base classes with YARD docs - Update RBS type signatures
- Use shorthand keyword argument syntax in Types.validate call - Use shorthand hash syntax in error data hash - Add rubocop:disable directive for MethodLength
- Add ErrorBuilder concern with process_message and build_errors methods - Remove inputs/validations/base.rb (no longer needed) - Remove inputs/validations/errors.rb (consolidated) - Remove maintenance/attributes/validations/base.rb (replaced by static methods) - Refactor Required and Must validators to use ErrorBuilder concern - Update Type validator with additional YARD documentation - Update RBS type signatures for refactored classes
- Delete CheckErrors class (replaced by direct error handling) - Delete Errors class (consolidated into ErrorBuilder) - Move error processing logic to ErrorBuilder concern - Simplify validation classes to return errors directly - Update validation tools to handle nil/errors return pattern - Update RBS type signatures for simplified structure
- Replace implicit truthiness with .present? for @first_error checks - Replace .nil? with .blank? for error message checks - Use direct assignment instead of ||= since break follows immediately
- Add directive to process_option methods in validation tools - Remove unnecessary directive from call_check method
- Replace unless .nil? with if .present? for consistency
- Document Required, Must, and Type validators with class-level docs - Add usage examples showing DSL patterns - Improve method documentation with param/return tags - Mark internal helper methods as private_class_method - Describe architecture decisions (zero allocations, early returns)
- Reword bullet points for clarity and consistency - Focus on behavioral descriptions over implementation details - Standardize return value description format
- Remove verbose Architecture sections from validators - Condense Result and Outputs class documentation - Keep essential usage examples and API documentation
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.
No description provided.