Skip to content

fix: validatorWithNonRepeatedConstraint cannot detect repeated constraint#122

Open
dorlolo wants to merge 1 commit intomwitkow:masterfrom
dorlolo:dorlolo
Open

fix: validatorWithNonRepeatedConstraint cannot detect repeated constraint#122
dorlolo wants to merge 1 commit intomwitkow:masterfrom
dorlolo:dorlolo

Conversation

@dorlolo
Copy link
Copy Markdown

@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