Conversation
Add allowEmpty parameter to the RequestParam attribute constructor, allowing annotation-driven services to accept empty strings without falling back to the array-based addParameters() approach. The parameter maps to ParamOption::EMPTY in configureParametersFromMethod(). Closes #148
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #149 +/- ##
============================================
- Coverage 93.86% 93.84% -0.03%
- Complexity 1361 1363 +2
============================================
Files 39 39
Lines 3310 3314 +4
============================================
+ Hits 3107 3110 +3
- Misses 203 204 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ass-level AllowAnonymous - Update single-service examples to use RequestProcessor instead of WebServicesManager - Remove unnecessary isAuthorized()/processRequest() boilerplate from annotation examples - Add examples/05-testing with ServiceTestCase usage - Add examples/03-annotations/02-allow-empty demonstrating allowEmpty - Fix checkMethodAuthorization() to respect class-level #[AllowAnonymous] - Update README testing section to use ServiceTestCase
|
|
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
Add
allowEmptyparameter to the#[RequestParam]attribute, allowing annotation-driven services to accept empty strings.Motivation
Users could not allow empty strings via annotations — they had to fall back to the imperative
addParameters()approach withParamOption::EMPTY => true. Fixes #148.Changes
public readonly bool $allowEmpty = falsetoRequestParamattribute constructorconfigureParametersFromMethod()to setParamOption::EMPTY => truewhenallowEmptyis trueAllowEmptyParamServicetest service andAllowEmptyParamTestwith 3 test casesallowEmptyattribute usage exampleHow to Test / Verify
Unit tests:
composer test -- --filter AllowEmptyParamTestAll 628 existing tests pass with no regressions.
Breaking Changes and Migration Steps
None. The new parameter defaults to
false, preserving existing behavior.Checklist
composer fix-cs)Related issues
Closes #148