-
Notifications
You must be signed in to change notification settings - Fork 36
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
Removed "required" tag from failOnValidationErrors #192
Removed "required" tag from failOnValidationErrors #192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either we remove the required
tag or keep this field as a pointer, so nil
would be considered empty. Now the default will be false
. That's fine. :)
+1 to keep as required and use pointer. |
@ricardozanini I agree to only removing the func (d *DataInputSchema) ApplyDefault() {
d.FailOnValidationErrors = true
} @venera-program You can add a test in https://github.com/serverlessworkflow/sdk-go/blob/main/model/workflow_validator_test.go |
@venera-program let's keep it as it is to simplify things rather than a pointer and please add a test case where @ribeiromiranda pointed out. 🙏 |
47876fa
to
91c3fa6
Compare
@ricardozanini I added a test that fails with the scenario caused by the old tag and a test parsing from a yaml source. Edit: PR is done from my end. |
Signed-off-by: Venera <[email protected]>
91c3fa6
to
7b24089
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ribeiromiranda can u review?
Review completed. |
@venera-program let me know if you need a patch release or if there's more to add before we do a release. |
What this PR does / why we need it:
Using the "required" tag on the
DataInputSchema.FailOnValidationErrors
field operates counter-intuitively to the go-playground docs. This also causes workflows to fail validation when the value of the field is manually set tofalse
because the validator interprets this as the default/unset value.Special notes for reviewers:
Not sure where to add a test for this case, need some insight on that front.
Additional information (if needed):
Go-playground doc reference: https://pkg.go.dev/github.com/go-playground/validator/v10#hdr-Required