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

Missing Validate Functions on Base Segment Type #191

Closed
mdross95 opened this issue May 10, 2024 · 2 comments · Fixed by #193
Closed

Missing Validate Functions on Base Segment Type #191

mdross95 opened this issue May 10, 2024 · 2 comments · Fixed by #193
Labels
enhancement New feature or request

Comments

@mdross95
Copy link
Contributor

Metro2 Version: 0.8.2

What were you trying to do?
Looking through base segment code in pkg/lib/base_segment.go.

What did you expect to see?
Expected to see Validate* functions that check provided values against a list of constants for all applicable base segment fields, similar to the existing ValidatePortfolioType().

What did you see?
Noticed absence of Validate* functions for quite a few applicable base segment fields in pkg/lib/base_segment.go. Examples I would have expected to see are ValidateAccountStatus(), ValidateAccountType(), ValidateSpecialComment(), and possibly more.

How can we reproduce the problem?
Constructing a base segment with, for example, AccountType of FF (an invalid CRRG value) and adding the segment via AddDataRecord allows the segment to be added, when I would expect a NewErrInvalidValueOfField error.

Mentioned this in the slack channel, happy to help with PR(s) to get some of these added if we decide it's appropriate!

@adamdecaf adamdecaf added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels May 13, 2024
@adamdecaf
Copy link
Member

This would be great to add! Do you have a PR started we can help flush out?

@mdross95
Copy link
Contributor Author

Great! I can have the PR up in the next day or two. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants