Repository navigation
Allow a bare validator name in @validators; report missing arguments - #112
Merged
Merged
Conversation
`@validators = [Positive]` is now the same as `[Positive()]`: the call's parentheses are optional. A property without a default that the call doesn't give is now an error (`validator 'Range' is missing argument 'min'`) - previously only codegen noticed, and only when generating.
Open
3 tasks
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.
@validators = [Positive]was a syntax error ("unrecognized or incomplete syntax"), so a validator with no properties had to be writtenPositive().AnnotationCall's(...)is now optional (AnnotationCallArgs, the same shape asAnnotationAssignment).AnnotationCall::args()returns&[]for a bare name. Rendering stays canonical:[Positive()].validation::missing-validator-argument(validator 'Range' is missing argument 'min'). Before this, only codegen caught it ("no value given, and it has no default"). A bare name that needs arguments now gets that error instead of a parse error.Tests: the bare form freezes to a
ValidatorRefwith no args, alongside a call; a missing required argument is reported; one with a default may be left out.