Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert HeightParser behavior to NOT return an error if DAU has no value #28

Closed
jonsagara opened this issue Mar 21, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working priority:1 Highest
Milestone

Comments

@jonsagara
Copy link
Owner

jonsagara commented Mar 21, 2024

The previous version of the parser returned null when the DAU field had no value, or its length was less than 3 characters:

if (string.IsNullOrEmpty(input) || input.Length < 3)
{
    return null;
}

The new version treats this as unparsed due to erroneous omission:

if (string.IsNullOrEmpty(rawValue) || rawValue.Length < 3)
{
    return FieldHelpers.UnparsedField<Height?>(elementId: elementId, rawValue: rawValue, $"Unable to parse Height from field '{SubfileElementIds.Height}': the field has no value, or has less than 3 characters: '{rawValue}'");
}

This causes problems for Michigan, which evidently allows the DAU element to be present without a value.

The AAMVA spec says Height (DAU) is a mandatory field, with this paragraph about missing data:

Mandatory data elements for which no data exists for a given cardholder are to be encoded with the word "NONE".
In the event data is not available for a mandatory data element, "unavl" is to be encoded.

MI apparently decided to rage against the machine and do neither of these things, and instead just leave the value blank. The original MI.txt test file has a blank DAU field.

To support this, split the "no value or length < 3" case into two separate clauses:

  • When value is null or white space, treat it as successfully parsed, and set the value to null
  • When value is less than 3 characters in length, treat it as an error because the field has a value, but we can't parse it
@jonsagara jonsagara self-assigned this Mar 21, 2024
@jonsagara jonsagara added bug Something isn't working priority:1 Highest labels Mar 21, 2024
@jonsagara jonsagara added this to the 3.0.0 milestone Mar 21, 2024
jonsagara added a commit that referenced this issue Mar 21, 2024
…reated as an error. A value less than 3 characters in length should still be treated as an error.
jonsagara added a commit that referenced this issue Mar 21, 2024
…identify NONE, unavl, or unavail as values indicating the Height is unavailable, in addition to string.IsNullOrWhiteSpace.
jonsagara added a commit that referenced this issue Mar 21, 2024
Fixes #28: In HeightParser, use `ParserHelper.StringHasNoValue` instead of `string.IsNullOrWhiteSpace`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:1 Highest
Projects
None yet
Development

No branches or pull requests

1 participant