protoc-gen-validate icon indicating copy to clipboard operation
protoc-gen-validate copied to clipboard

How to use it?

Open MayukhSobo opened this issue 1 year ago • 4 comments

I have a proto file called user.proto like following

syntax = "proto3";

package user;

import "validate/validate.proto";

option go_package = "pkg/proto/user";

message User {
    required string id = 1;
    required string name = 2 [
        (validate.rules).string.min_len = 2,
        (validate.rules).string.max_len = 50
    ];
}

I am using validate/validate.proto file as mentioned in the official docs here but I seems to get import error like

validate/validate.proto: File not found.
user.proto:5:1: Import "validate/validate.proto" was not found or had errors.

How can I import this??

MayukhSobo avatar Jun 26 '23 07:06 MayukhSobo

This is a degradation in v1.0.2. your code used to work for me before latest update (20 hours ago). The file location hasent changed, its still under validate/validate.proto. Try using v1.0.1.

linamusallam avatar Jun 27 '23 13:06 linamusallam

Hello, I am having the same issue on both 1.02 and 1.0.1. Did you manage to resolve it?

SebastienMelki avatar Jul 12 '23 00:07 SebastienMelki

@SebastienMelki You need to copy validate/validate.proto to your repository

yurifedoseev avatar Jul 17 '23 08:07 yurifedoseev

I have tried copying the validate/validate.proto file to my project but I am still getting the same issue. If this is an official step for usage, should this be included in the readme?

brianhumphreys avatar Aug 03 '23 16:08 brianhumphreys

Hello, thanks for your interest! As explained in the README, this project is in maintenance mode. We recommend upgrading to protovalidate.

I'm going to go ahead and close this issue, but feel free to open one against protovalidate if needed. Thanks!

chrispine avatar Feb 29 '24 19:02 chrispine