Skip to content

Commit

Permalink
custom header validator
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimpe committed Jul 31, 2024
1 parent 6bbb0f1 commit 0533f04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 1 addition & 8 deletions tdrs-backend/tdpservice/parsers/schema_defs/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,7 @@
startIndex=22,
endIndex=23,
required=True,
validators=[
FieldValidators.isEqual(
"D", error_func=lambda eargs: (
f"HEADER Update Indicator must be set to D instead of {eargs.value}. "
"Please review Exporting Complete Data Using FTANF in the Knowledge Center."
)
),
],
validators=[FieldValidators.validateHeaderUpdateIndicator()],
),
],
)
10 changes: 10 additions & 0 deletions tdrs-backend/tdpservice/parsers/validators/category2.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,13 @@ def validateRace():
f"{format_error_context(eargs)} {eargs.value} is not greater than or equal to 0 "
"or smaller than or equal to 2."
)

@staticmethod
def validateHeaderUpdateIndicator():
"""Validate the header update indicator."""
return make_validator(
ValidatorFunctions.isEqual('D'),
lambda eargs:
f"HEADER Update Indicator must be set to D instead of {eargs.value}. "
"Please review Exporting Complete Data Using FTANF in the Knowledge Center."
)

0 comments on commit 0533f04

Please sign in to comment.