diff --git a/WORKSPACE b/WORKSPACE index 60ac320c..7adc46da 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -72,3 +72,6 @@ scala_repositories() register_toolchains("//toolchains:scala_proto_deps_toolchain") register_toolchains("//toolchains:scala_proto_fs2_grpc_toolchain") + +load("//:common_protos.bzl", "common_protos_dependencies") +common_protos_dependencies() diff --git a/common_protos.bzl b/common_protos.bzl index 3082a7fa..cedd080e 100644 --- a/common_protos.bzl +++ b/common_protos.bzl @@ -24,3 +24,51 @@ proto_library( ) """ ) + +# validate_sha = "04e84b10ceef0008673460bcf06f036b2add8d80" +# http_archive( +# name = "validate_protos", +# # sha256 = "22087a397beb5d40ff9c93463c61643d05bcabe1dfcbe67511e87f61385e9e54", +# strip_prefix = "protoc-gen-validate-%s" % validate_sha, +# url = "https://github.com/bufbuild/protoc-gen-validate/archive/%s.zip" % validate_sha, +# workspace_file_content = "", +# build_file_content = """ +# proto_library( +# name = "validate_protos", +# visibility = ["//visibility:public"], +# deps = [ +# "@common_protos//:scalapb_protos", +# "@common_protos//:common_protos" +# ], +# srcs = glob(["validate/*.proto"] +# ) +# """ +# ) + + validate_scalapb_sha = "5d5e886f6ede389fc35b9a676728be39e2c391d8" + http_archive( + name = "validate_scalapb_protos", + # sha256 = "22087a397beb5d40ff9c93463c61643d05bcabe1dfcbe67511e87f61385e9e54", + strip_prefix = "scalapb-validate-%s" % validate_scalapb_sha, + url = "https://github.com/scalapb/scalapb-validate/archive/%s.zip" % validate_scalapb_sha, + build_file_content = """ +proto_library( + name = "validate_scalapb_protos", + visibility = ["//visibility:public"], + deps = [ + "@common_protos//:scalapb_protos", + "@fs2_grpc//validate" + ], + srcs = glob(["core/src/main/protobuf/scalapb/*.proto"]), + strip_import_prefix = "core/src/main/protobuf/scalapb" +) + """ + ) + + google_api_common_protos_sha = "3332dec527759859840a3a2ff108c67a54708130" + http_archive( + name = "google_api_common_protos", + # sha256 = "22087a397beb5d40ff9c93463c61643d05bcabe1dfcbe67511e87f61385e9e54", + strip_prefix = "api-common-protos-%s" % google_api_common_protos_sha, + url = "https://github.com/googleapis/api-common-protos/archive/%s.zip" % google_api_common_protos_sha + ) diff --git a/dependencies.bzl b/dependencies.bzl index 8208019a..a298e6b5 100644 --- a/dependencies.bzl +++ b/dependencies.bzl @@ -31,6 +31,10 @@ project_deps = [ # usage java_dependency("io.grpc", "grpc-netty-shaded", grpc_version), scala_dependency("org.typelevel", "fs2-grpc-runtime", "2.7.4"), + + scala_dependency("com.thesamet.scalapb", "scalapb-validate-core" , "0.3.4"), + scala_dependency("com.thesamet.scalapb", "scalapb-validate-codegen" , "0.3.4"), + scala_dependency("com.thesamet.scalapb.common-protos", "proto-google-common-protos-scalapb_0.11", "2.9.6-0") ] def add_scala_fullver(s): diff --git a/maven_install.json b/maven_install.json index da80a951..fdcff772 100644 --- a/maven_install.json +++ b/maven_install.json @@ -1,10 +1,56 @@ { "dependency_tree": { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": 1721692040, - "__RESOLVED_ARTIFACTS_HASH": -278162552, + "__INPUT_ARTIFACTS_HASH": 1349702042, + "__RESOLVED_ARTIFACTS_HASH": -2140056139, "conflict_resolution": {}, "dependencies": [ + { + "coord": "build.buf.protoc-gen-validate:pgv-java-stub:0.6.13", + "dependencies": [ + "com.google.protobuf:protobuf-java:3.21.7", + "com.google.protobuf:protobuf-java-util:3.21.7", + "commons-validator:commons-validator:1.7", + "com.google.re2j:re2j:1.5" + ], + "directDependencies": [ + "com.google.protobuf:protobuf-java:3.21.7", + "com.google.protobuf:protobuf-java-util:3.21.7", + "com.google.re2j:re2j:1.5", + "commons-validator:commons-validator:1.7" + ], + "file": "v1/https/repo.maven.apache.org/maven2/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13.jar", + "https://mvnrepository.com/artifact/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13.jar", + "https://maven-central.storage.googleapis.com/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13.jar" + ], + "sha256": "2e0e8b9f572732da57799b6fdd54abf1104bcd9615579b77622d66b36974e400", + "url": "https://repo.maven.apache.org/maven2/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13.jar" + }, + { + "coord": "build.buf.protoc-gen-validate:pgv-java-stub:jar:sources:0.6.13", + "dependencies": [ + "commons-validator:commons-validator:jar:sources:1.7", + "com.google.re2j:re2j:jar:sources:1.5", + "com.google.protobuf:protobuf-java-util:jar:sources:3.21.7", + "com.google.protobuf:protobuf-java:jar:sources:3.21.7" + ], + "directDependencies": [ + "com.google.protobuf:protobuf-java:jar:sources:3.21.7", + "com.google.protobuf:protobuf-java-util:jar:sources:3.21.7", + "com.google.re2j:re2j:jar:sources:1.5", + "commons-validator:commons-validator:jar:sources:1.7" + ], + "file": "v1/https/repo.maven.apache.org/maven2/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13-sources.jar", + "https://mvnrepository.com/artifact/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13-sources.jar", + "https://maven-central.storage.googleapis.com/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13-sources.jar" + ], + "sha256": "a87c38951488e61c84377d05a1ad68995d84214867780b7216c9eac462a55e44", + "url": "https://repo.maven.apache.org/maven2/build/buf/protoc-gen-validate/pgv-java-stub/0.6.13/pgv-java-stub-0.6.13-sources.jar" + }, { "coord": "co.fs2:fs2-core_2.13:3.7.0", "dependencies": [ @@ -84,7 +130,7 @@ "url": "https://repo.maven.apache.org/maven2/com/google/android/annotations/4.1.1.4/annotations-4.1.1.4-sources.jar" }, { - "coord": "com.google.api.grpc:proto-google-common-protos:2.9.0", + "coord": "com.google.api.grpc:proto-google-common-protos:2.9.6", "dependencies": [ "com.google.protobuf:protobuf-java:3.21.7" ], @@ -94,17 +140,17 @@ "exclusions": [ "com.google.api:api-common" ], - "file": "v1/https/repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0.jar", + "file": "v1/https/repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6.jar", "mirror_urls": [ - "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0.jar", - "https://mvnrepository.com/artifact/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0.jar", - "https://maven-central.storage.googleapis.com/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0.jar" + "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6.jar", + "https://mvnrepository.com/artifact/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6.jar", + "https://maven-central.storage.googleapis.com/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6.jar" ], - "sha256": "0d830380ec66bd7e25eee63aa0a5a08578e46ad187fb72d99b44d9ba22827f91", - "url": "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0.jar" + "sha256": "84e715d92500fd0d44408f58713d5d70ae857d022de3d66d500fbf27fae88103", + "url": "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6.jar" }, { - "coord": "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.0", + "coord": "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.6", "dependencies": [ "com.google.protobuf:protobuf-java:jar:sources:3.21.7" ], @@ -114,14 +160,14 @@ "exclusions": [ "com.google.api:api-common" ], - "file": "v1/https/repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0-sources.jar", + "file": "v1/https/repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6-sources.jar", "mirror_urls": [ - "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0-sources.jar", - "https://mvnrepository.com/artifact/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0-sources.jar", - "https://maven-central.storage.googleapis.com/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0-sources.jar" + "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6-sources.jar", + "https://mvnrepository.com/artifact/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6-sources.jar", + "https://maven-central.storage.googleapis.com/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6-sources.jar" ], - "sha256": "ea54fe7b9585f69f819c63dec60d8334654ece38e331fa8d6ed11e11a6affba2", - "url": "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.0/proto-google-common-protos-2.9.0-sources.jar" + "sha256": "30f16a93235974625109dd4d58c2e5a329cfb40f606eebd52d1f39c02b1c1d6e", + "url": "https://repo.maven.apache.org/maven2/com/google/api/grpc/proto-google-common-protos/2.9.6/proto-google-common-protos-2.9.6-sources.jar" }, { "coord": "com.google.code.findbugs:jsr305:3.0.2", @@ -406,6 +452,130 @@ "sha256": "c664e12e6e3fea801477edf95014980a8a96528d3904d2add90c68b5d047a6c2", "url": "https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.21.7/protobuf-java-3.21.7-sources.jar" }, + { + "coord": "com.google.re2j:re2j:1.5", + "dependencies": [], + "directDependencies": [], + "file": "v1/https/repo.maven.apache.org/maven2/com/google/re2j/re2j/1.5/re2j-1.5.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/google/re2j/re2j/1.5/re2j-1.5.jar", + "https://mvnrepository.com/artifact/com/google/re2j/re2j/1.5/re2j-1.5.jar", + "https://maven-central.storage.googleapis.com/com/google/re2j/re2j/1.5/re2j-1.5.jar" + ], + "sha256": "c062f67e5b11c66650e45c0f420b1d5768e8b8009b0b3b5daf9bcc5880a7894c", + "url": "https://repo.maven.apache.org/maven2/com/google/re2j/re2j/1.5/re2j-1.5.jar" + }, + { + "coord": "com.google.re2j:re2j:jar:sources:1.5", + "dependencies": [], + "directDependencies": [], + "file": "v1/https/repo.maven.apache.org/maven2/com/google/re2j/re2j/1.5/re2j-1.5-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/google/re2j/re2j/1.5/re2j-1.5-sources.jar", + "https://mvnrepository.com/artifact/com/google/re2j/re2j/1.5/re2j-1.5-sources.jar", + "https://maven-central.storage.googleapis.com/com/google/re2j/re2j/1.5/re2j-1.5-sources.jar" + ], + "sha256": "5ef7a56139b34a5eb94a3a8052cd9061149f9295003950c293a8f6dece74ee1d", + "url": "https://repo.maven.apache.org/maven2/com/google/re2j/re2j/1.5/re2j-1.5-sources.jar" + }, + { + "coord": "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:0.6.13-0", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "com.google.protobuf:protobuf-java:3.21.7", + "com.google.protobuf:protobuf-java-util:3.21.7", + "org.scala-lang:scala-library:2.13.11", + "com.google.re2j:re2j:1.5", + "commons-validator:commons-validator:1.7", + "build.buf.protoc-gen-validate:pgv-java-stub:0.6.13" + ], + "directDependencies": [ + "build.buf.protoc-gen-validate:pgv-java-stub:0.6.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "org.scala-lang:scala-library:2.13.11" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0.jar" + ], + "sha256": "5d55449b22a3537f663d7ec9b4e3fd2959e9a5029521709d6806e20c5e61cf67", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0.jar" + }, + { + "coord": "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:jar:sources:0.6.13-0", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11", + "com.google.re2j:re2j:jar:sources:1.5", + "com.google.protobuf:protobuf-java:jar:sources:3.21.7", + "commons-validator:commons-validator:jar:sources:1.7", + "com.google.protobuf:protobuf-java-util:jar:sources:3.21.7", + "build.buf.protoc-gen-validate:pgv-java-stub:jar:sources:0.6.13" + ], + "directDependencies": [ + "build.buf.protoc-gen-validate:pgv-java-stub:jar:sources:0.6.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0-sources.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0-sources.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0-sources.jar" + ], + "sha256": "4116c1a77429df60707cb83d82a1847acdc41265f68acb02e6f8e87a250210e7", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/pgv-proto-scalapb_0.11_2.13/0.6.13-0/pgv-proto-scalapb_0.11_2.13-0.6.13-0-sources.jar" + }, + { + "coord": "com.thesamet.scalapb.common-protos:proto-google-common-protos-scalapb_0.11_2.13:2.9.6-0", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "com.google.protobuf:protobuf-java:3.21.7", + "com.google.api.grpc:proto-google-common-protos:2.9.6", + "com.thesamet.scalapb:scalapb-runtime-grpc_2.13:0.11.13", + "org.scala-lang:scala-library:2.13.11" + ], + "directDependencies": [ + "com.google.api.grpc:proto-google-common-protos:2.9.6", + "com.thesamet.scalapb:scalapb-runtime-grpc_2.13:0.11.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "org.scala-lang:scala-library:2.13.11" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0.jar" + ], + "sha256": "11cddfd88b7a4f23b6f3ecaadd9bc18d814b77555059b610228c866199c8585e", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0.jar" + }, + { + "coord": "com.thesamet.scalapb.common-protos:proto-google-common-protos-scalapb_0.11_2.13:jar:sources:2.9.6-0", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime-grpc_2.13:jar:sources:0.11.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11", + "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.6", + "com.google.protobuf:protobuf-java:jar:sources:3.21.7" + ], + "directDependencies": [ + "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.6", + "com.thesamet.scalapb:scalapb-runtime-grpc_2.13:jar:sources:0.11.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0-sources.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0-sources.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0-sources.jar" + ], + "sha256": "91381c72a365ad162c5b79d25b41cb9a3908b8fc506e96c1c24ad6f5c8e0103b", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/common-protos/proto-google-common-protos-scalapb_0.11_2.13/2.9.6-0/proto-google-common-protos-scalapb_0.11_2.13-2.9.6-0-sources.jar" + }, { "coord": "com.thesamet.scalapb:compilerplugin_2.13:0.11.13", "dependencies": [ @@ -672,6 +842,150 @@ "sha256": "cc48b123ad7a0fea0a390766d20b7d8d596a8182b689506feef033432bc8ccb1", "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.13/0.11.13/scalapb-runtime_2.13-0.11.13-sources.jar" }, + { + "coord": "com.thesamet.scalapb:scalapb-validate-codegen_2.13:0.3.4", + "dependencies": [ + "com.thesamet.scalapb:compilerplugin_2.13:0.11.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "com.google.protobuf:protobuf-java:3.21.7", + "com.google.protobuf:protobuf-java-util:3.21.7", + "org.scala-lang:scala-library:2.13.11", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:0.6.13-0", + "com.google.re2j:re2j:1.5", + "commons-validator:commons-validator:1.7", + "build.buf.protoc-gen-validate:pgv-java-stub:0.6.13" + ], + "directDependencies": [ + "com.thesamet.scalapb:compilerplugin_2.13:0.11.13", + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "com.google.protobuf:protobuf-java:3.21.7", + "org.scala-lang:scala-library:2.13.11", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:0.6.13-0" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4.jar" + ], + "sha256": "2f21b3d48af5b4ca73907d19602e0c3412ab56c1695ba0ea49cacbfb85a6a22c", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4.jar" + }, + { + "coord": "com.thesamet.scalapb:scalapb-validate-codegen_2.13:jar:sources:0.3.4", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11", + "com.google.re2j:re2j:jar:sources:1.5", + "com.google.protobuf:protobuf-java:jar:sources:3.21.7", + "commons-validator:commons-validator:jar:sources:1.7", + "com.google.protobuf:protobuf-java-util:jar:sources:3.21.7", + "build.buf.protoc-gen-validate:pgv-java-stub:jar:sources:0.6.13", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:jar:sources:0.6.13-0", + "com.thesamet.scalapb:compilerplugin_2.13:jar:sources:0.11.13" + ], + "directDependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11", + "com.google.protobuf:protobuf-java:jar:sources:3.21.7", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:jar:sources:0.6.13-0", + "com.thesamet.scalapb:compilerplugin_2.13:jar:sources:0.11.13" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4-sources.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4-sources.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4-sources.jar" + ], + "sha256": "c26cf4dc036ae46696ea23f06ef29b0bfb3c8b1e7319c26e7fa5caccdd592829", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-codegen_2.13/0.3.4/scalapb-validate-codegen_2.13-0.3.4-sources.jar" + }, + { + "coord": "com.thesamet.scalapb:scalapb-validate-core_2.13:0.3.4", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "com.google.protobuf:protobuf-java:3.21.7", + "com.google.protobuf:protobuf-java-util:3.21.7", + "org.scala-lang:scala-library:2.13.11", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:0.6.13-0", + "com.google.re2j:re2j:1.5", + "commons-validator:commons-validator:1.7", + "build.buf.protoc-gen-validate:pgv-java-stub:0.6.13" + ], + "directDependencies": [ + "com.google.protobuf:protobuf-java:3.21.7", + "com.thesamet.scalapb:scalapb-runtime_2.13:0.11.13", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:0.6.13-0", + "org.scala-lang:scala-library:2.13.11" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar" + ], + "sha256": "4a233f4d687a3461ff8b74d0f17f18a42922ec15057acc41b7e877ae3c9bee08", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4.jar" + }, + { + "coord": "com.thesamet.scalapb:scalapb-validate-core_2.13:jar:sources:0.3.4", + "dependencies": [ + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "org.scala-lang:scala-library:jar:sources:2.13.11", + "com.google.re2j:re2j:jar:sources:1.5", + "com.google.protobuf:protobuf-java:jar:sources:3.21.7", + "commons-validator:commons-validator:jar:sources:1.7", + "com.google.protobuf:protobuf-java-util:jar:sources:3.21.7", + "build.buf.protoc-gen-validate:pgv-java-stub:jar:sources:0.6.13", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:jar:sources:0.6.13-0" + ], + "directDependencies": [ + "com.google.protobuf:protobuf-java:jar:sources:3.21.7", + "com.thesamet.scalapb:scalapb-runtime_2.13:jar:sources:0.11.13", + "com.thesamet.scalapb.common-protos:pgv-proto-scalapb_0.11_2.13:jar:sources:0.6.13-0", + "org.scala-lang:scala-library:jar:sources:2.13.11" + ], + "file": "v1/https/repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4-sources.jar", + "https://mvnrepository.com/artifact/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4-sources.jar", + "https://maven-central.storage.googleapis.com/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4-sources.jar" + ], + "sha256": "6051dd0908e18b507e166abd383eea89ee0491d8a2d0e6b1e308d753076fbf82", + "url": "https://repo.maven.apache.org/maven2/com/thesamet/scalapb/scalapb-validate-core_2.13/0.3.4/scalapb-validate-core_2.13-0.3.4-sources.jar" + }, + { + "coord": "commons-validator:commons-validator:1.7", + "dependencies": [], + "directDependencies": [], + "exclusions": [ + "*:*" + ], + "file": "v1/https/repo.maven.apache.org/maven2/commons-validator/commons-validator/1.7/commons-validator-1.7.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/commons-validator/commons-validator/1.7/commons-validator-1.7.jar", + "https://mvnrepository.com/artifact/commons-validator/commons-validator/1.7/commons-validator-1.7.jar", + "https://maven-central.storage.googleapis.com/commons-validator/commons-validator/1.7/commons-validator-1.7.jar" + ], + "sha256": "4d74f4ce4fb68b2617edad086df6defdf9338467d2377d2c62e69038e1c4f02f", + "url": "https://repo.maven.apache.org/maven2/commons-validator/commons-validator/1.7/commons-validator-1.7.jar" + }, + { + "coord": "commons-validator:commons-validator:jar:sources:1.7", + "dependencies": [], + "directDependencies": [], + "exclusions": [ + "*:*" + ], + "file": "v1/https/repo.maven.apache.org/maven2/commons-validator/commons-validator/1.7/commons-validator-1.7-sources.jar", + "mirror_urls": [ + "https://repo.maven.apache.org/maven2/commons-validator/commons-validator/1.7/commons-validator-1.7-sources.jar", + "https://mvnrepository.com/artifact/commons-validator/commons-validator/1.7/commons-validator-1.7-sources.jar", + "https://maven-central.storage.googleapis.com/commons-validator/commons-validator/1.7/commons-validator-1.7-sources.jar" + ], + "sha256": "f3c5c975db3bfb46ee32151de9c76553a3c92ed45725afa8bdd6fb9ce553b60d", + "url": "https://repo.maven.apache.org/maven2/commons-validator/commons-validator/1.7/commons-validator-1.7-sources.jar" + }, { "coord": "dev.dirs:directories:26", "dependencies": [], @@ -1097,8 +1411,8 @@ "com.google.code.findbugs:jsr305:3.0.2", "io.grpc:grpc-context:1.54.1", "io.grpc:grpc-protobuf-lite:1.54.1", - "com.google.api.grpc:proto-google-common-protos:2.9.0", "com.google.protobuf:protobuf-java:3.21.7", + "com.google.api.grpc:proto-google-common-protos:2.9.6", "org.checkerframework:checker-qual:3.12.0", "io.grpc:grpc-api:1.54.1", "com.google.guava:failureaccess:1.0.1", @@ -1107,8 +1421,8 @@ "directDependencies": [ "com.google.code.findbugs:jsr305:3.0.2", "io.grpc:grpc-protobuf-lite:1.54.1", - "com.google.api.grpc:proto-google-common-protos:2.9.0", "com.google.protobuf:protobuf-java:3.21.7", + "com.google.api.grpc:proto-google-common-protos:2.9.6", "io.grpc:grpc-api:1.54.1", "com.google.guava:guava:31.1-android" ], @@ -1129,21 +1443,21 @@ "com.google.code.findbugs:jsr305:jar:sources:3.0.2", "com.google.j2objc:j2objc-annotations:jar:sources:1.3", "io.grpc:grpc-context:jar:sources:1.54.1", + "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.6", "io.grpc:grpc-protobuf-lite:jar:sources:1.54.1", "com.google.protobuf:protobuf-java:jar:sources:3.21.7", "io.grpc:grpc-api:jar:sources:1.54.1", "org.checkerframework:checker-qual:jar:sources:3.12.0", "com.google.guava:listenablefuture:jar:sources:9999.0-empty-to-avoid-conflict-with-guava", - "com.google.guava:failureaccess:jar:sources:1.0.1", - "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.0" + "com.google.guava:failureaccess:jar:sources:1.0.1" ], "directDependencies": [ "com.google.guava:guava:jar:sources:31.1-android", "com.google.code.findbugs:jsr305:jar:sources:3.0.2", + "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.6", "io.grpc:grpc-protobuf-lite:jar:sources:1.54.1", "com.google.protobuf:protobuf-java:jar:sources:3.21.7", - "io.grpc:grpc-api:jar:sources:1.54.1", - "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.0" + "io.grpc:grpc-api:jar:sources:1.54.1" ], "file": "v1/https/repo.maven.apache.org/maven2/io/grpc/grpc-protobuf/1.54.1/grpc-protobuf-1.54.1-sources.jar", "mirror_urls": [ @@ -1165,11 +1479,11 @@ "com.google.android:annotations:4.1.1.4", "io.grpc:grpc-protobuf-lite:1.54.1", "com.google.code.gson:gson:2.9.0", - "com.google.api.grpc:proto-google-common-protos:2.9.0", "io.grpc:grpc-core:1.54.1", "io.grpc:grpc-stub:1.54.1", "com.google.protobuf:protobuf-java:3.21.7", "com.google.protobuf:protobuf-java-util:3.21.7", + "com.google.api.grpc:proto-google-common-protos:2.9.6", "org.checkerframework:checker-qual:3.12.0", "io.grpc:grpc-protobuf:1.54.1", "io.grpc:grpc-api:1.54.1", @@ -1205,6 +1519,7 @@ "com.google.code.gson:gson:jar:sources:2.9.0", "com.google.j2objc:j2objc-annotations:jar:sources:1.3", "io.grpc:grpc-context:jar:sources:1.54.1", + "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.6", "io.grpc:grpc-protobuf-lite:jar:sources:1.54.1", "com.google.protobuf:protobuf-java:jar:sources:3.21.7", "io.grpc:grpc-api:jar:sources:1.54.1", @@ -1216,8 +1531,7 @@ "com.google.guava:listenablefuture:jar:sources:9999.0-empty-to-avoid-conflict-with-guava", "com.google.guava:failureaccess:jar:sources:1.0.1", "com.google.protobuf:protobuf-java-util:jar:sources:3.21.7", - "io.grpc:grpc-core:jar:sources:1.54.1", - "com.google.api.grpc:proto-google-common-protos:jar:sources:2.9.0" + "io.grpc:grpc-core:jar:sources:1.54.1" ], "directDependencies": [ "com.google.errorprone:error_prone_annotations:jar:sources:2.18.0", diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel index 14f1dccc..8af5b6bd 100644 --- a/toolchains/BUILD.bazel +++ b/toolchains/BUILD.bazel @@ -7,9 +7,12 @@ declare_deps_provider( deps = [ "@maven//:org_scala_lang_scala_library", "@maven//:com_google_protobuf_protobuf_java", + "@maven//:build_buf_protoc_gen_validate_pgv_java_stub", "@maven//:com_thesamet_scalapb_protoc_gen_2_13", "@maven//:com_thesamet_scalapb_protoc_bridge_2_13", "@maven//:com_thesamet_scalapb_compilerplugin_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13" ] ) @@ -18,6 +21,7 @@ declare_deps_provider( deps_id = "scalapb_compile_deps", deps = [ "@maven//:com_google_protobuf_protobuf_java", + "@maven//:build_buf_protoc_gen_validate_pgv_java_stub", "@maven//:com_thesamet_scalapb_lenses_2_13", "@maven//:com_thesamet_scalapb_scalapb_runtime_2_13", "@maven//:com_thesamet_scalapb_scalapb_runtime_grpc_2_13", @@ -33,6 +37,8 @@ declare_deps_provider( "@maven//:org_typelevel_cats_kernel_2_13", "@maven//:co_fs2_fs2_core_2_13", "//:runtime", + "@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13", # "@maven//:org_typelevel_fs2_grpc_runtime_2_13", "@maven//:io_grpc_grpc_api", @@ -51,6 +57,8 @@ declare_deps_provider( deps_id = "scalapb_grpc_deps", deps = [ "@maven//:com_thesamet_scalapb_protoc_gen_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13", ], ) @@ -74,11 +82,15 @@ scala_proto_toolchain( extra_generator_dependencies = [ "@fs2_grpc//:codegen", "@maven//:com_thesamet_scalapb_protoc_gen_2_13", - "@maven//:com_thesamet_scalapb_protoc_bridge_2_13" + "@maven//:com_thesamet_scalapb_protoc_bridge_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13", + "@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13", ], main_generator = "scalapb.ScalaPbCodeGenerator", + # main_generator = "scalapb.validate.compiler.CodeGenerator", named_generators = { "fs2": "fs2.grpc.codegen.Fs2CodeGenerator", + "scala": "scalapb.validate.compiler.CodeGenerator" }, with_grpc = True, with_flat_package = True diff --git a/validate/BUILD.bazel b/validate/BUILD.bazel new file mode 100644 index 00000000..5d5c90ed --- /dev/null +++ b/validate/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +proto_library( + name = "validate", + srcs = ["validate.proto"], + deps = ["@common_protos//:common_protos"], + visibility = ["//visibility:public"], +) diff --git a/validate/validate.proto b/validate/validate.proto new file mode 100644 index 00000000..705d382a --- /dev/null +++ b/validate/validate.proto @@ -0,0 +1,862 @@ +syntax = "proto2"; +package validate; + +option go_package = "github.com/envoyproxy/protoc-gen-validate/validate"; +option java_package = "io.envoyproxy.pgv.validate"; + +import "google/protobuf/descriptor.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// Validation rules applied at the message level +extend google.protobuf.MessageOptions { + // Disabled nullifies any validation rules for this message, including any + // message fields associated with it that do support validation. + optional bool disabled = 1071; + // Ignore skips generation of validation methods for this message. + optional bool ignored = 1072; +} + +// Validation rules applied at the oneof level +extend google.protobuf.OneofOptions { + // Required ensures that exactly one the field options in a oneof is set; + // validation fails if no fields in the oneof are set. + optional bool required = 1071; +} + +// Validation rules applied at the field level +extend google.protobuf.FieldOptions { + // Rules specify the validations to be performed on this field. By default, + // no validation is performed against a field. + optional FieldRules rules = 1071; +} + +// FieldRules encapsulates the rules for each type of field. Depending on the +// field, the correct set should be used to ensure proper validations. +message FieldRules { + optional MessageRules message = 17; + oneof type { + // Scalar Field Types + FloatRules float = 1; + DoubleRules double = 2; + Int32Rules int32 = 3; + Int64Rules int64 = 4; + UInt32Rules uint32 = 5; + UInt64Rules uint64 = 6; + SInt32Rules sint32 = 7; + SInt64Rules sint64 = 8; + Fixed32Rules fixed32 = 9; + Fixed64Rules fixed64 = 10; + SFixed32Rules sfixed32 = 11; + SFixed64Rules sfixed64 = 12; + BoolRules bool = 13; + StringRules string = 14; + BytesRules bytes = 15; + + // Complex Field Types + EnumRules enum = 16; + RepeatedRules repeated = 18; + MapRules map = 19; + + // Well-Known Field Types + AnyRules any = 20; + DurationRules duration = 21; + TimestampRules timestamp = 22; + } +} + +// FloatRules describes the constraints applied to `float` values +message FloatRules { + // Const specifies that this field must be exactly the specified value + optional float const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional float lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional float lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional float gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional float gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated float in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated float not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// DoubleRules describes the constraints applied to `double` values +message DoubleRules { + // Const specifies that this field must be exactly the specified value + optional double const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional double lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional double lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional double gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional double gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated double in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated double not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Int32Rules describes the constraints applied to `int32` values +message Int32Rules { + // Const specifies that this field must be exactly the specified value + optional int32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional int32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional int32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional int32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional int32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated int32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Int64Rules describes the constraints applied to `int64` values +message Int64Rules { + // Const specifies that this field must be exactly the specified value + optional int64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional int64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional int64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional int64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional int64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated int64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// UInt32Rules describes the constraints applied to `uint32` values +message UInt32Rules { + // Const specifies that this field must be exactly the specified value + optional uint32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional uint32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional uint32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional uint32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional uint32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated uint32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated uint32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// UInt64Rules describes the constraints applied to `uint64` values +message UInt64Rules { + // Const specifies that this field must be exactly the specified value + optional uint64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional uint64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional uint64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional uint64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional uint64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated uint64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated uint64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SInt32Rules describes the constraints applied to `sint32` values +message SInt32Rules { + // Const specifies that this field must be exactly the specified value + optional sint32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sint32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sint32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sint32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sint32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sint32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sint32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SInt64Rules describes the constraints applied to `sint64` values +message SInt64Rules { + // Const specifies that this field must be exactly the specified value + optional sint64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sint64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sint64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sint64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sint64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sint64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sint64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Fixed32Rules describes the constraints applied to `fixed32` values +message Fixed32Rules { + // Const specifies that this field must be exactly the specified value + optional fixed32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional fixed32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional fixed32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional fixed32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional fixed32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated fixed32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated fixed32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// Fixed64Rules describes the constraints applied to `fixed64` values +message Fixed64Rules { + // Const specifies that this field must be exactly the specified value + optional fixed64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional fixed64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional fixed64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional fixed64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional fixed64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated fixed64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated fixed64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SFixed32Rules describes the constraints applied to `sfixed32` values +message SFixed32Rules { + // Const specifies that this field must be exactly the specified value + optional sfixed32 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sfixed32 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sfixed32 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sfixed32 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sfixed32 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sfixed32 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sfixed32 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// SFixed64Rules describes the constraints applied to `sfixed64` values +message SFixed64Rules { + // Const specifies that this field must be exactly the specified value + optional sfixed64 const = 1; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional sfixed64 lt = 2; + + // Lte specifies that this field must be less than or equal to the + // specified value, inclusive + optional sfixed64 lte = 3; + + // Gt specifies that this field must be greater than the specified value, + // exclusive. If the value of Gt is larger than a specified Lt or Lte, the + // range is reversed. + optional sfixed64 gt = 4; + + // Gte specifies that this field must be greater than or equal to the + // specified value, inclusive. If the value of Gte is larger than a + // specified Lt or Lte, the range is reversed. + optional sfixed64 gte = 5; + + // In specifies that this field must be equal to one of the specified + // values + repeated sfixed64 in = 6; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated sfixed64 not_in = 7; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 8; +} + +// BoolRules describes the constraints applied to `bool` values +message BoolRules { + // Const specifies that this field must be exactly the specified value + optional bool const = 1; +} + +// StringRules describe the constraints applied to `string` values +message StringRules { + // Const specifies that this field must be exactly the specified value + optional string const = 1; + + // Len specifies that this field must be the specified number of + // characters (Unicode code points). Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 len = 19; + + // MinLen specifies that this field must be the specified number of + // characters (Unicode code points) at a minimum. Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 min_len = 2; + + // MaxLen specifies that this field must be the specified number of + // characters (Unicode code points) at a maximum. Note that the number of + // characters may differ from the number of bytes in the string. + optional uint64 max_len = 3; + + // LenBytes specifies that this field must be the specified number of bytes + optional uint64 len_bytes = 20; + + // MinBytes specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 min_bytes = 4; + + // MaxBytes specifies that this field must be the specified number of bytes + // at a maximum + optional uint64 max_bytes = 5; + + // Pattern specifes that this field must match against the specified + // regular expression (RE2 syntax). The included expression should elide + // any delimiters. + optional string pattern = 6; + + // Prefix specifies that this field must have the specified substring at + // the beginning of the string. + optional string prefix = 7; + + // Suffix specifies that this field must have the specified substring at + // the end of the string. + optional string suffix = 8; + + // Contains specifies that this field must have the specified substring + // anywhere in the string. + optional string contains = 9; + + // NotContains specifies that this field cannot have the specified substring + // anywhere in the string. + optional string not_contains = 23; + + // In specifies that this field must be equal to one of the specified + // values + repeated string in = 10; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated string not_in = 11; + + // WellKnown rules provide advanced constraints against common string + // patterns + oneof well_known { + // Email specifies that the field must be a valid email address as + // defined by RFC 5322 + bool email = 12; + + // Hostname specifies that the field must be a valid hostname as + // defined by RFC 1034. This constraint does not support + // internationalized domain names (IDNs). + bool hostname = 13; + + // Ip specifies that the field must be a valid IP (v4 or v6) address. + // Valid IPv6 addresses should not include surrounding square brackets. + bool ip = 14; + + // Ipv4 specifies that the field must be a valid IPv4 address. + bool ipv4 = 15; + + // Ipv6 specifies that the field must be a valid IPv6 address. Valid + // IPv6 addresses should not include surrounding square brackets. + bool ipv6 = 16; + + // Uri specifies that the field must be a valid, absolute URI as defined + // by RFC 3986 + bool uri = 17; + + // UriRef specifies that the field must be a valid URI as defined by RFC + // 3986 and may be relative or absolute. + bool uri_ref = 18; + + // Address specifies that the field must be either a valid hostname as + // defined by RFC 1034 (which does not support internationalized domain + // names or IDNs), or it can be a valid IP (v4 or v6). + bool address = 21; + + // Uuid specifies that the field must be a valid UUID as defined by + // RFC 4122 + bool uuid = 22; + + // WellKnownRegex specifies a common well known pattern defined as a regex. + KnownRegex well_known_regex = 24; + } + + // This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable + // strict header validation. + // By default, this is true, and HTTP header validations are RFC-compliant. + // Setting to false will enable a looser validations that only disallows + // \r\n\0 characters, which can be used to bypass header matching rules. + optional bool strict = 25 [default = true]; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 26; +} + +// WellKnownRegex contain some well-known patterns. +enum KnownRegex { + UNKNOWN = 0; + + // HTTP header name as defined by RFC 7230. + HTTP_HEADER_NAME = 1; + + // HTTP header value as defined by RFC 7230. + HTTP_HEADER_VALUE = 2; +} + +// BytesRules describe the constraints applied to `bytes` values +message BytesRules { + // Const specifies that this field must be exactly the specified value + optional bytes const = 1; + + // Len specifies that this field must be the specified number of bytes + optional uint64 len = 13; + + // MinLen specifies that this field must be the specified number of bytes + // at a minimum + optional uint64 min_len = 2; + + // MaxLen specifies that this field must be the specified number of bytes + // at a maximum + optional uint64 max_len = 3; + + // Pattern specifes that this field must match against the specified + // regular expression (RE2 syntax). The included expression should elide + // any delimiters. + optional string pattern = 4; + + // Prefix specifies that this field must have the specified bytes at the + // beginning of the string. + optional bytes prefix = 5; + + // Suffix specifies that this field must have the specified bytes at the + // end of the string. + optional bytes suffix = 6; + + // Contains specifies that this field must have the specified bytes + // anywhere in the string. + optional bytes contains = 7; + + // In specifies that this field must be equal to one of the specified + // values + repeated bytes in = 8; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated bytes not_in = 9; + + // WellKnown rules provide advanced constraints against common byte + // patterns + oneof well_known { + // Ip specifies that the field must be a valid IP (v4 or v6) address in + // byte format + bool ip = 10; + + // Ipv4 specifies that the field must be a valid IPv4 address in byte + // format + bool ipv4 = 11; + + // Ipv6 specifies that the field must be a valid IPv6 address in byte + // format + bool ipv6 = 12; + } + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 14; +} + +// EnumRules describe the constraints applied to enum values +message EnumRules { + // Const specifies that this field must be exactly the specified value + optional int32 const = 1; + + // DefinedOnly specifies that this field must be only one of the defined + // values for this enum, failing on any undefined value. + optional bool defined_only = 2; + + // In specifies that this field must be equal to one of the specified + // values + repeated int32 in = 3; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated int32 not_in = 4; +} + +// MessageRules describe the constraints applied to embedded message values. +// For message-type fields, validation is performed recursively. +message MessageRules { + // Skip specifies that the validation rules of this field should not be + // evaluated + optional bool skip = 1; + + // Required specifies that this field must be set + optional bool required = 2; +} + +// RepeatedRules describe the constraints applied to `repeated` values +message RepeatedRules { + // MinItems specifies that this field must have the specified number of + // items at a minimum + optional uint64 min_items = 1; + + // MaxItems specifies that this field must have the specified number of + // items at a maximum + optional uint64 max_items = 2; + + // Unique specifies that all elements in this field must be unique. This + // contraint is only applicable to scalar and enum types (messages are not + // supported). + optional bool unique = 3; + + // Items specifies the contraints to be applied to each item in the field. + // Repeated message fields will still execute validation against each item + // unless skip is specified here. + optional FieldRules items = 4; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 5; +} + +// MapRules describe the constraints applied to `map` values +message MapRules { + // MinPairs specifies that this field must have the specified number of + // KVs at a minimum + optional uint64 min_pairs = 1; + + // MaxPairs specifies that this field must have the specified number of + // KVs at a maximum + optional uint64 max_pairs = 2; + + // NoSparse specifies values in this field cannot be unset. This only + // applies to map's with message value types. + optional bool no_sparse = 3; + + // Keys specifies the constraints to be applied to each key in the field. + optional FieldRules keys = 4; + + // Values specifies the constraints to be applied to the value of each key + // in the field. Message values will still have their validations evaluated + // unless skip is specified here. + optional FieldRules values = 5; + + // IgnoreEmpty specifies that the validation rules of this field should be + // evaluated only if the field is not empty + optional bool ignore_empty = 6; +} + +// AnyRules describe constraints applied exclusively to the +// `google.protobuf.Any` well-known type +message AnyRules { + // Required specifies that this field must be set + optional bool required = 1; + + // In specifies that this field's `type_url` must be equal to one of the + // specified values. + repeated string in = 2; + + // NotIn specifies that this field's `type_url` must not be equal to any of + // the specified values. + repeated string not_in = 3; +} + +// DurationRules describe the constraints applied exclusively to the +// `google.protobuf.Duration` well-known type +message DurationRules { + // Required specifies that this field must be set + optional bool required = 1; + + // Const specifies that this field must be exactly the specified value + optional google.protobuf.Duration const = 2; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional google.protobuf.Duration lt = 3; + + // Lt specifies that this field must be less than the specified value, + // inclusive + optional google.protobuf.Duration lte = 4; + + // Gt specifies that this field must be greater than the specified value, + // exclusive + optional google.protobuf.Duration gt = 5; + + // Gte specifies that this field must be greater than the specified value, + // inclusive + optional google.protobuf.Duration gte = 6; + + // In specifies that this field must be equal to one of the specified + // values + repeated google.protobuf.Duration in = 7; + + // NotIn specifies that this field cannot be equal to one of the specified + // values + repeated google.protobuf.Duration not_in = 8; +} + +// TimestampRules describe the constraints applied exclusively to the +// `google.protobuf.Timestamp` well-known type +message TimestampRules { + // Required specifies that this field must be set + optional bool required = 1; + + // Const specifies that this field must be exactly the specified value + optional google.protobuf.Timestamp const = 2; + + // Lt specifies that this field must be less than the specified value, + // exclusive + optional google.protobuf.Timestamp lt = 3; + + // Lte specifies that this field must be less than the specified value, + // inclusive + optional google.protobuf.Timestamp lte = 4; + + // Gt specifies that this field must be greater than the specified value, + // exclusive + optional google.protobuf.Timestamp gt = 5; + + // Gte specifies that this field must be greater than the specified value, + // inclusive + optional google.protobuf.Timestamp gte = 6; + + // LtNow specifies that this must be less than the current time. LtNow + // can only be used with the Within rule. + optional bool lt_now = 7; + + // GtNow specifies that this must be greater than the current time. GtNow + // can only be used with the Within rule. + optional bool gt_now = 8; + + // Within specifies that this field must be within this duration of the + // current time. This constraint can be used alone or with the LtNow and + // GtNow rules. + optional google.protobuf.Duration within = 9; +}