feature: validate array with fixed length #2496
Labels
flag: needs discussion
Issues which needs discussion before implementation.
type: feature
Issues related to new features.
Description
Unlike strings, array fields often contain a fixed number of elements (i.e. consider the case where the coordinates are received as an array of size 2), and I usually have to validate this manually by checking the minimum size and the maximum size simultaneously. Although this issue is easy to overcome, a more direct approach would improve readability and produce cleaner code.
Proposed solution
I propose creating the
@ArraySize
decorator that validates the array's size against the provided argumentThe text was updated successfully, but these errors were encountered: