validate
validate copied to clipboard
As a user, I want to validate that the field_number values are sequential and match the label specification for maximum number of fields
Motivation
...so that we ensure when field_number values are defined (which are optional) they are valid according to the SR definition
Additional Information
All of the classes inheriting Field
contain the optional field_number
attribute. Currently it looks like this is not sanity checked.
The attribute is defined as:
The field_number attribute provides the position of a field, within a series of fields, counting from 1. If two fields within a record are physically separated by one or more groups, they have consecutive field numbers; the fields within the intervening group(s) are numbered separately. Fields within a group separated by one or more (sub)groups, will also have consecutive field numbers.
-
Products with some fields including this and some not are allowed - this is fine, per standard, but I wonder if a warning shouldn't be given?
-
More importantly, no error is raised when
-
field_number
is greater than the maximum number of fields expected from the definition of the record - if the field number "misses" values (e.g. 1, 2, 5, 6)
📜 To Reproduce
- Validate the attached test product - this includes "missing" field numbers, and values that are > number of fields.
🕵️ Expected behavior
The user is notified that the field numbering does not match the standards, and an appropriate warning/error is given.
📚 Version of Software Used
2.0.4
🩺 Test Data / Additional context
🖥 System Info
- OS: linux
- Version: ubuntu 20.04
Engineering Details
if Field.field_number exists
check the field number is sequential
check the field number < maximum number of fields as defined by the label