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: validatorWithNonRepeatedConstraint cannot detect repeated constraint #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dorlolo
Copy link

@dorlolo dorlolo commented Oct 25, 2023

the problem part of .proto file

message ArtworkUidsRequest{
  repeated string ArtworkUids =1 [(validator.field)={repeated_count_min:1,human_error:"13021"}]; 
}

then, generated codes like this. item is not uesd.

func (this *ArtworkUidsRequest) Validate() error {
	if len(this.ArtworkUids) < 1 {
		return github_com_mwitkow_go_proto_validators.FieldError("ArtworkUids", fmt.Errorf(`13021`))
	}
	for _, item := range this.ArtworkUids {
	}
	return nil
}

when i check the code, i found the function validatorWithNonRepeatedConstraint cannot detect the two fields "RepeatedCountMin" and "RepeatedCountMax"

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.

1 participant