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

fix(109): split foreach state to separate file #118

Merged
merged 1 commit into from
Nov 2, 2022
Merged

fix(109): split foreach state to separate file #118

merged 1 commit into from
Nov 2, 2022

Conversation

lsytj0413
Copy link
Collaborator

Signed-off-by: lsytj0413 511121939@qq.com

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:

Special notes for reviewers:

Additional information (if needed):

Fixed #109

Signed-off-by: lsytj0413 <511121939@qq.com>
case intstr.String:
v, err := strconv.Atoi(stateObj.BatchSize.StrVal)
if err != nil {
structLevel.ReportError(reflect.ValueOf(stateObj.BatchSize), "BatchSize", "batchSize", "gt0", err.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this gt0 stands for greater than 0, it is fine, but, in the error it will be reported like:
failed on the 'gt0' tag

It is not clear why exactly it has failed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this gt0 stands for greater than 0, it is fine, but, in the error it will be reported like: failed on the 'gt0' tag

It is not clear why exactly it has failed.

It's the limit of validator library, we cann't report detail message other than tag name. Maybe we can fix it later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could try to use another thing as tag name.
maybe the field or subfield name.

In the future we could extend the validator to override these messages, I don't know how validator works, but I guess we could extend it, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we want to custom the error message we can do this like go-playground/validator#559. I think we can create an issue for this.

@ricardozanini ricardozanini merged commit 7723e03 into serverlessworkflow:main Nov 2, 2022
@lsytj0413 lsytj0413 deleted the fix-109 branch November 3, 2022 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move ForEachState to an separate foreach_state.go file
3 participants