From 95e7cf7f9302d50170aea03f889610675e9724b9 Mon Sep 17 00:00:00 2001 From: ymmt Date: Thu, 2 Mar 2023 07:47:04 +0000 Subject: [PATCH] Add cybozu.validate package cybozu.validate is a normalization and validation system for Protocol Buffers. The repository is set up for a Buf module in order to prepare publishing protobuf files on BSR. This commit does not include any code generator but includes a hand-written Go code `examples/validation_cybozu_validate2.pb.go` to demonstrate what to be generated. --- .github/ISSUE_TEMPLATE/bug_report.md | 28 + .github/ISSUE_TEMPLATE/issue.md | 23 + .github/workflows/ci.yaml | 15 + .github/workflows/release.yaml | 36 + .gitignore | 7 +- .goreleaser.yaml | 44 + Makefile | 85 + README.md | 69 +- buf.go-cybozu-validate.gen.yaml | 6 + buf.go.gen.yaml | 6 + buf.md | 9 + buf.yaml | 11 + cmd/protoc-gen-go-cybozu-validate/main.go | 4 + create-tag.sh | 39 + cybozu/validate/design.md | 93 + cybozu/validate/options.pb.go | 1878 ++++++++++++++++++++ cybozu/validate/options.proto | 299 ++++ cybozu/validate/validate.go | 31 + examples/validation.pb.go | 1341 ++++++++++++++ examples/validation.proto | 208 +++ examples/validation_custom.go | 23 + examples/validation_cybozu_validate2.pb.go | 394 ++++ examples/validation_test.go | 31 + go.mod | 15 + go.sum | 27 + 25 files changed, 4718 insertions(+), 4 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/issue.md create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml create mode 100644 Makefile create mode 100644 buf.go-cybozu-validate.gen.yaml create mode 100644 buf.go.gen.yaml create mode 100644 buf.md create mode 100644 buf.yaml create mode 100644 cmd/protoc-gen-go-cybozu-validate/main.go create mode 100755 create-tag.sh create mode 100644 cybozu/validate/design.md create mode 100644 cybozu/validate/options.pb.go create mode 100644 cybozu/validate/options.proto create mode 100644 cybozu/validate/validate.go create mode 100644 examples/validation.pb.go create mode 100644 examples/validation.proto create mode 100644 examples/validation_custom.go create mode 100644 examples/validation_cybozu_validate2.pb.go create mode 100644 examples/validation_test.go create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..d7cce9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Environments** +- Version: +- OS: + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/issue.md b/.github/ISSUE_TEMPLATE/issue.md new file mode 100644 index 0000000..8755fcd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue.md @@ -0,0 +1,23 @@ +--- +name: Task +about: Describe this issue +title: '' +labels: '' +assignees: '' + +--- + +## What + +Describe what this issue should address. + +## How + +Describe how to address the issue. + +## Checklist + +- [ ] Finish implementation of the issue +- [ ] Test all functions +- [ ] Have enough logs to trace activities +- [ ] Notify developers of necessary actions diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..88326ba --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,15 @@ +name: CI +on: [push] +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: go.mod + cache: true + - run: make lint + - run: make check-generate + - run: make test diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..e0c269a --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,36 @@ +name: Release +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + name: Release on GitHub + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version-file: go.mod + cache: true + - uses: bufbuild/buf-setup-action@b5ee8ca8d082edeeb8b0fc7fe1178ae0d671816a # v1.15.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: bufbuild/buf-push-action@1c45f6a21ec277ee4c1fa2772e49b9541ea17f38 # v1.1.1 + with: + buf_token: ${{ secrets.BSR_TOKEN }} + - name: GoReleaser + uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 66fd13c..af19f35 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,8 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out -# Dependency directories (remove the comment below to include it) -# vendor/ +# Downloaded files +/bin + +# For GoReleaser +/dist diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..530660b --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,44 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + main: ./cmd/protoc-gen-go-cybozu-validate + binary: protoc-gen-go-cybozu-validate + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of uname. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +release: + prerelease: auto + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..885384a --- /dev/null +++ b/Makefile @@ -0,0 +1,85 @@ +# Makefile for compiling protobuf files + +# Tool versions +BUF_VERSION = 1.15.0 +GO_VERSION := $(shell awk '/^go / {print $$2}' go.mod) +PROTOC_GEN_GO_VERSION := $(shell awk '/google.golang.org\/protobuf/ {print substr($$NF, 2)}' go.mod) + + +## sanity checks +ifeq ($(shell go version | grep -F $(GO_VERSION)),) +$(error Go must be version $(GO_VERSION)) +endif + +# Variables +PWD := $(shell pwd) +BUF = $(PWD)/bin/buf +RUN_BUF = PATH=$(PWD)/bin:$$PATH ./bin/buf +PROTOC_GEN_GO = $(PWD)/bin/protoc-gen-go +PROTOC_GEN_GO_CYBOZU_VALIDATE = $(PWD)/bin/protoc-gen-go-validate + +help: + @echo 'Available targets:' + @echo ' all: build everything.' + @echo ' test: run tests.' + @echo ' clean: remove downloaded files.' + @echo ' check-generate: test if the generated files are up-to-date or not.' + @echo ' lint: lint protobuf files.' + @echo ' format: format protobuf files.' + @echo ' go: generate Go code with protoc-gen-go.' + @echo ' validate: generate code for normalization/validation.' + @echo ' create-tag: creates a new Git tag.' + +$(BUF): + mkdir -p bin + GOBIN=$(PWD)/bin go install github.com/bufbuild/buf/cmd/buf@v$(BUF_VERSION) + +$(PROTOC_GEN_GO): + mkdir -p bin + GOBIN=$(PWD)/bin go install google.golang.org/protobuf/cmd/protoc-gen-go@v$(PROTOC_GEN_GO_VERSION) + +$(PROTOC_GEN_GO_CYBOZU_VALIDATE): + mkdir -p bin + go build -o $@ ./cmd/protoc-gen-go-cybozu-validate + +.PHONY: all +all: + $(MAKE) format + $(MAKE) go + echo skip this for now $(MAKE) validate + +.PHONY: test +test: + go test -count 1 -v ./... + go vet ./... + test -z $$(gofmt -s -l . | tee /dev/stderr) + +.PHONY: clean +clean: + rm -rf bin dist + +.PHONY: check-generate +check-generate: + $(MAKE) all + go mod tidy + git diff --exit-code --name-only + +.PHONY: lint +lint: $(BUF) + $(RUN_BUF) lint + +.PHONY: format +format: $(BUF) + $(RUN_BUF) format -w + +.PHONY: go +go: $(BUF) $(PROTOC_GEN_GO) + $(RUN_BUF) generate --template buf.go.gen.yaml + +.PHONY: validate +validate: $(BUF) $(PROTOC_GEN_GO_CYBOZU_VALIDATE) + $(RUN_BUF) generate --template buf.go-cybozu-validate.gen.yaml + +.PHONY: create-tag +create-tag: + ./create-tag.sh diff --git a/README.md b/README.md index 22e4263..31022f5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,67 @@ -# protonorm -Normalization and validation system for Protocol Buffers +# Cybozu Public Protocol Buffers Schema + +This repository contains public Protocol Buffer files and related tools from Cybozu. + +This repository forms a [Buf module][module] to publish protobuf files on [BSR][BSR]. +You can import packages in this repository by adding the following lines to `buf.yaml`. + +```yaml +version: v1 +deps: +- buf.build/cybozu/protobuf +``` + +If you are not familiar with `buf`, read https://docs.buf.build/manuals/cli/overview + +## `cybozu.validate` + +This protobuf package provides custom options to normalize and validate messages. +Read [examples/validation.proto](examples/validation.proto) for example usage. + +You can get the code generator for Go as follows: + +```console +$ go install github.com/cybozu/protobuf/cmd/protoc-gen-go-cybozu-validate@latest +``` + +The following is an example `buf.gen.yaml` to generate validation code: + +```yaml +version: v1 +plugins: + - plugin: go + out: . + opt: paths=source_relative + - plugin: go-cybozu-validate + out: . + opt: paths=source_relative +``` + +## API documentation + +Visit https://buf.build/cybozu/protobuf + +## Versioning and backward-compatibility + +We keep backward-compatibility of Protocol Buffers files. +When we want to add breaking changes to Protocol Buffers files, we create +a different package like `cybozu.foo.v2` not to break the current package. + +However, the generated code in this repository may not be backward compatible. +For example, Go code generated by `protoc-gen-go` may not be always backward compatible. + +So, we use a [semver](https://semver.org/) with major version zero (0.y.z) to +tag this repository to declare the generated code may bring breaking changes. + +### For developers + +Running `make create-tag` creates a new tag and push it to GitHub automatically. +The rest of the release process will be done by GitHub Actions. + +## License + +All code in this repository is licensed under the Apache License Version 2.0. +Read [LICENSE](LICENSE) for terms and conditions. + +[module]: https://docs.buf.build/bsr/overview#modules +[BSR]: https://docs.buf.build/bsr/introduction diff --git a/buf.go-cybozu-validate.gen.yaml b/buf.go-cybozu-validate.gen.yaml new file mode 100644 index 0000000..2756fad --- /dev/null +++ b/buf.go-cybozu-validate.gen.yaml @@ -0,0 +1,6 @@ +version: v1 +plugins: + - name: go-cybozu-validate + out: . + opt: + - paths=source_relative diff --git a/buf.go.gen.yaml b/buf.go.gen.yaml new file mode 100644 index 0000000..e12aff0 --- /dev/null +++ b/buf.go.gen.yaml @@ -0,0 +1,6 @@ +version: v1 +plugins: + - name: go + out: . + opt: + - paths=source_relative diff --git a/buf.md b/buf.md new file mode 100644 index 0000000..3aae00d --- /dev/null +++ b/buf.md @@ -0,0 +1,9 @@ +# Cybozu Public Protocol Buffers Schema + +This module provides Protocol Buffers packages that are intended for public use. +Currently, following packages are available: + +- `cybozu.validate`: custom options for generating normalization & validation code. +- `examples`: usage examples of our custom Protocol Buffer options. + +The source code is available on https://github.com/cybozu/protobuf diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000..dd2dc00 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,11 @@ +version: v1 +name: buf.build/cybozu/protobuf +breaking: + use: + - FILE +lint: + use: + - BASIC + except: + - ENUM_PASCAL_CASE + - ENUM_NO_ALLOW_ALIAS diff --git a/cmd/protoc-gen-go-cybozu-validate/main.go b/cmd/protoc-gen-go-cybozu-validate/main.go new file mode 100644 index 0000000..da29a2c --- /dev/null +++ b/cmd/protoc-gen-go-cybozu-validate/main.go @@ -0,0 +1,4 @@ +package main + +func main() { +} diff --git a/create-tag.sh b/create-tag.sh new file mode 100755 index 0000000..7982e5f --- /dev/null +++ b/create-tag.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +if [ "$(git branch --show-current)" != main ]; then + echo "not on the main branch." + exit 1 +fi + +echo "Running git pull to be up-to-date." +git fetch origin --prune --prune-tags + +MAJOR=0 +MINOR=$(date '+%Y%m%d') +REV=0 + +while true; do + TAG=v${MAJOR}.${MINOR}.${REV} + if git tag | grep -qF ${TAG}; then + REV=$((REV + 1)) + else + break + fi +done + +echo "Creating a new Git tag ${TAG}" +echo -n "Proceed? [y/N]: " +read t +if echo $t | grep -i '^y'; then + : +else + echo "Aborted." + exit 1 +fi + +git tag -a -m "Release ${TAG}" ${TAG} +git push origin ${TAG} + +echo "Tagged and pushed ${TAG}" diff --git a/cybozu/validate/design.md b/cybozu/validate/design.md new file mode 100644 index 0000000..db57203 --- /dev/null +++ b/cybozu/validate/design.md @@ -0,0 +1,93 @@ +# Design notes + +- [Background and motivation](#background-and-motivation) +- [Why we create a new tool](#why-we-create-a-new-tool) +- [Goals](#goals) +- [The actual design](#the-actual-design) + - [Normalization/validation rules](#normalizationvalidation-rules) + - [Code generator](#code-generator) + - [The generated code](#the-generated-code) + +## Background and motivation + +Protocol Buffers and gRPC enables schema-first style API development. +With them, both clients and servers can handle requests and responses +in a type-safe manner in a statically typed language. + +However, the standard code generation tools of Protocol Buffers such +as `protoc-gen-go` does not generate code to validate values. All +message fields in Protocol Buffers are optional, so we cannot even +ensure a field value is set. + +Since validating values in request messages is considered a generic +requirement, we wanted to generate code for request validation from +Protocol Buffers. + +## Why we create a new tool + +There are a few existing tools to generate validation code from Protocol +Buffers as of March in 2023. + +- [bufbuild/protoc-gen-validate][PGV] +- [mwitkow/go-proto-validators][go-proto-validators] + +We do not use these tools because our requirements are different. +We wanted to do some normalization and canonicalizaion over string values +_before_ validation. + +UNICODE has different byte representations for the same string. For example, +"が" can be represented in UTF-8 either `0xE3`, `0x81`, `0x8C` or +`0xE3`, `0x81`, `0x8B`, `0xE3`, `0x82`, `0x99`. Without a normalization like +NFC, we could not compare two semantically same UNICODE strings. + +Moreover, we wanted to enforce a string to match a common pattern such as URI +or email address and canonicalize them automatically. For example, +a URI `HTTPS://example.com/` should be canonicalized to `https://example.com/`. + +## Goals + +- UNICODE strings are always normalized. +- Provide a set of predefined rules for common use cases. +- The rules should be language agnostic so that we can generate validation code for any language. +- No dependency on gRPC implementation. + - There are two gRPC implementations for Go, namely, `grpc-go` and `connect-go`. We do not enforce either. + +## The actual design + +### Normalization/validation rules + +We provide custom options of Protocol Buffers to declare +normalization/validation rules. The rule syntax is inspired from +[bufbuild/protoc-gen-validate][PGV] but adds normalization rules and removes +unnecessary rules for us. + +In addition to the standard UNICODE normalization forms such as NFC or NFKD, +we provide normalization and validation using [PRECIS framework][PRECIS] +because PRECIS profiles are useful for usernames and passwords. + +The options are language-agnostic; they should not rely on features or +functions that are not available for all languages. + +### Code generator + +We create a code generator for each target language. + +For Go, we create `protoc-gen-go-cybozu-validate`. +For ECMAScript/TypeScript, we create `protoc-gen-es-cybozu-validate`. + +This is because generating code for a target language is generally easy +when the same language is used. + +### The generated code + +The generated code should add a validation method to the generated struct or +class for each protobuf message. This is consistent with what other tools +are doing. + +For Go, we will add `Validate() error` method to generated structs. +The error returned is not a gRPC error to avoid dependency on a specific +gRPC implementation. + +[PGV]: https://github.com/bufbuild/protoc-gen-validate +[go-proto-validators]: https://github.com/mwitkow/go-proto-validators +[PRECIS]: https://www.rfc-editor.org/rfc/rfc8264.html diff --git a/cybozu/validate/options.pb.go b/cybozu/validate/options.pb.go new file mode 100644 index 0000000..114fb05 --- /dev/null +++ b/cybozu/validate/options.pb.go @@ -0,0 +1,1878 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: cybozu/validate/options.proto + +// Custom extensions to generate code for gRPC request validation/normalization. +// +// The custom options defined here are: +// - `cybozu.validate.ignored` message option. +// - `cybozu.validate.required` oneof option. +// - `cybozu.validate.rules` field option. +// +// To generate normalization/validation code, use `protoc-gen-$LANG-cybozu-validate` +// for the target language. + +package validate + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// UNICODE normalization forms. +// In addition to the forms defined by https://www.unicode.org/reports/tr15/, +// we include PRECIS profiles as they are considered a variant of the NFC form. +type StringRules_UnicodeNormalizationForm int32 + +const ( + // NFC form as defined by https://www.unicode.org/reports/tr15/ + StringRules_NFC StringRules_UnicodeNormalizationForm = 0 + // NFD form as defined by https://www.unicode.org/reports/tr15/ + StringRules_NFD StringRules_UnicodeNormalizationForm = 1 + // NFKC form as defined by https://www.unicode.org/reports/tr15/ + StringRules_NFKC StringRules_UnicodeNormalizationForm = 2 + // NFKD form as defined by https://www.unicode.org/reports/tr15/ + StringRules_NFKD StringRules_UnicodeNormalizationForm = 3 + // PRECIS UsernameCaseMapped profile as defined by RFC 8265 + StringRules_PRECIS_USERNAME_CASE_MAPPED StringRules_UnicodeNormalizationForm = 100 + // PRECIS UsernameCasePreserved profile as defined by RFC 8265 + StringRules_PRECIS_USERNAME_CASE_PRESERVED StringRules_UnicodeNormalizationForm = 101 + // PRECIS OpaqueString profile as defined by RFC 8265 + StringRules_PRECIS_OPAQUE_STRING StringRules_UnicodeNormalizationForm = 102 +) + +// Enum value maps for StringRules_UnicodeNormalizationForm. +var ( + StringRules_UnicodeNormalizationForm_name = map[int32]string{ + 0: "NFC", + 1: "NFD", + 2: "NFKC", + 3: "NFKD", + 100: "PRECIS_USERNAME_CASE_MAPPED", + 101: "PRECIS_USERNAME_CASE_PRESERVED", + 102: "PRECIS_OPAQUE_STRING", + } + StringRules_UnicodeNormalizationForm_value = map[string]int32{ + "NFC": 0, + "NFD": 1, + "NFKC": 2, + "NFKD": 3, + "PRECIS_USERNAME_CASE_MAPPED": 100, + "PRECIS_USERNAME_CASE_PRESERVED": 101, + "PRECIS_OPAQUE_STRING": 102, + } +) + +func (x StringRules_UnicodeNormalizationForm) Enum() *StringRules_UnicodeNormalizationForm { + p := new(StringRules_UnicodeNormalizationForm) + *p = x + return p +} + +func (x StringRules_UnicodeNormalizationForm) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StringRules_UnicodeNormalizationForm) Descriptor() protoreflect.EnumDescriptor { + return file_cybozu_validate_options_proto_enumTypes[0].Descriptor() +} + +func (StringRules_UnicodeNormalizationForm) Type() protoreflect.EnumType { + return &file_cybozu_validate_options_proto_enumTypes[0] +} + +func (x StringRules_UnicodeNormalizationForm) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StringRules_UnicodeNormalizationForm.Descriptor instead. +func (StringRules_UnicodeNormalizationForm) EnumDescriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{9, 0} +} + +// FieldRules encapsulates the rules for each type of field. +// Depending on the field type, one or two rule sets can be specified. +type FieldRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // One of these constraints can be specified for a field. + // + // If the field is `optional` and not set, the specified rule will not be applied. + // For a map type field like `map`, you may specify a rule for the value type, here `int64`. + // + // Types that are assignable to Type: + // + // *FieldRules_Float + // *FieldRules_Double + // *FieldRules_Int32 + // *FieldRules_Int64 + // *FieldRules_Uint32 + // *FieldRules_Uint64 + // *FieldRules_Sint32 + // *FieldRules_Sint64 + // *FieldRules_Fixed32 + // *FieldRules_Fixed64 + // *FieldRules_Sfixed32 + // *FieldRules_Sfixed64 + // *FieldRules_Bool + // *FieldRules_String_ + // *FieldRules_Bytes + // *FieldRules_Enum + // *FieldRules_Message + Type isFieldRules_Type `protobuf_oneof:"type"` + // One of these constraints can be specified for a repeated field or a map field. + // + // Types that are assignable to Items: + // + // *FieldRules_Repeated + // *FieldRules_Map + Items isFieldRules_Items `protobuf_oneof:"items"` +} + +func (x *FieldRules) Reset() { + *x = FieldRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldRules) ProtoMessage() {} + +func (x *FieldRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldRules.ProtoReflect.Descriptor instead. +func (*FieldRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{0} +} + +func (m *FieldRules) GetType() isFieldRules_Type { + if m != nil { + return m.Type + } + return nil +} + +func (x *FieldRules) GetFloat() *FloatRules { + if x, ok := x.GetType().(*FieldRules_Float); ok { + return x.Float + } + return nil +} + +func (x *FieldRules) GetDouble() *DoubleRules { + if x, ok := x.GetType().(*FieldRules_Double); ok { + return x.Double + } + return nil +} + +func (x *FieldRules) GetInt32() *Int32Rules { + if x, ok := x.GetType().(*FieldRules_Int32); ok { + return x.Int32 + } + return nil +} + +func (x *FieldRules) GetInt64() *Int64Rules { + if x, ok := x.GetType().(*FieldRules_Int64); ok { + return x.Int64 + } + return nil +} + +func (x *FieldRules) GetUint32() *Uint32Rules { + if x, ok := x.GetType().(*FieldRules_Uint32); ok { + return x.Uint32 + } + return nil +} + +func (x *FieldRules) GetUint64() *Uint64Rules { + if x, ok := x.GetType().(*FieldRules_Uint64); ok { + return x.Uint64 + } + return nil +} + +func (x *FieldRules) GetSint32() *Int32Rules { + if x, ok := x.GetType().(*FieldRules_Sint32); ok { + return x.Sint32 + } + return nil +} + +func (x *FieldRules) GetSint64() *Int64Rules { + if x, ok := x.GetType().(*FieldRules_Sint64); ok { + return x.Sint64 + } + return nil +} + +func (x *FieldRules) GetFixed32() *Uint32Rules { + if x, ok := x.GetType().(*FieldRules_Fixed32); ok { + return x.Fixed32 + } + return nil +} + +func (x *FieldRules) GetFixed64() *Uint64Rules { + if x, ok := x.GetType().(*FieldRules_Fixed64); ok { + return x.Fixed64 + } + return nil +} + +func (x *FieldRules) GetSfixed32() *Int32Rules { + if x, ok := x.GetType().(*FieldRules_Sfixed32); ok { + return x.Sfixed32 + } + return nil +} + +func (x *FieldRules) GetSfixed64() *Int64Rules { + if x, ok := x.GetType().(*FieldRules_Sfixed64); ok { + return x.Sfixed64 + } + return nil +} + +func (x *FieldRules) GetBool() *BoolRules { + if x, ok := x.GetType().(*FieldRules_Bool); ok { + return x.Bool + } + return nil +} + +func (x *FieldRules) GetString_() *StringRules { + if x, ok := x.GetType().(*FieldRules_String_); ok { + return x.String_ + } + return nil +} + +func (x *FieldRules) GetBytes() *BytesRules { + if x, ok := x.GetType().(*FieldRules_Bytes); ok { + return x.Bytes + } + return nil +} + +func (x *FieldRules) GetEnum() *EnumRules { + if x, ok := x.GetType().(*FieldRules_Enum); ok { + return x.Enum + } + return nil +} + +func (x *FieldRules) GetMessage() *MessageRules { + if x, ok := x.GetType().(*FieldRules_Message); ok { + return x.Message + } + return nil +} + +func (m *FieldRules) GetItems() isFieldRules_Items { + if m != nil { + return m.Items + } + return nil +} + +func (x *FieldRules) GetRepeated() *ItemsRules { + if x, ok := x.GetItems().(*FieldRules_Repeated); ok { + return x.Repeated + } + return nil +} + +func (x *FieldRules) GetMap() *ItemsRules { + if x, ok := x.GetItems().(*FieldRules_Map); ok { + return x.Map + } + return nil +} + +type isFieldRules_Type interface { + isFieldRules_Type() +} + +type FieldRules_Float struct { + // `float` can be specified for a float type field. + Float *FloatRules `protobuf:"bytes,1,opt,name=float,proto3,oneof"` +} + +type FieldRules_Double struct { + // `double` can be specified for a double type field. + Double *DoubleRules `protobuf:"bytes,2,opt,name=double,proto3,oneof"` +} + +type FieldRules_Int32 struct { + // `int32` can be specified for an int32 type field. + Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,proto3,oneof"` +} + +type FieldRules_Int64 struct { + // `int64` can be specified for an int64 type field. + Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,proto3,oneof"` +} + +type FieldRules_Uint32 struct { + // `uint32` can be specified for a uint32 type field. + Uint32 *Uint32Rules `protobuf:"bytes,5,opt,name=uint32,proto3,oneof"` +} + +type FieldRules_Uint64 struct { + // `uint64` can be specified for a uint64 type field. + Uint64 *Uint64Rules `protobuf:"bytes,6,opt,name=uint64,proto3,oneof"` +} + +type FieldRules_Sint32 struct { + // `sint32` can be specified for a sint32 type field. + Sint32 *Int32Rules `protobuf:"bytes,7,opt,name=sint32,proto3,oneof"` +} + +type FieldRules_Sint64 struct { + // `sint64` can be specified for a sint64 type field. + Sint64 *Int64Rules `protobuf:"bytes,8,opt,name=sint64,proto3,oneof"` +} + +type FieldRules_Fixed32 struct { + // `fixed32` can be specified for a fixed32 type field. + Fixed32 *Uint32Rules `protobuf:"bytes,9,opt,name=fixed32,proto3,oneof"` +} + +type FieldRules_Fixed64 struct { + // `fixed64` can be specified for a fixed64 type field. + Fixed64 *Uint64Rules `protobuf:"bytes,10,opt,name=fixed64,proto3,oneof"` +} + +type FieldRules_Sfixed32 struct { + // `sfixed32` can be specified for an sfixed32 type field. + Sfixed32 *Int32Rules `protobuf:"bytes,11,opt,name=sfixed32,proto3,oneof"` +} + +type FieldRules_Sfixed64 struct { + // `sfixed64` can be specified for an sfixed64 type field. + Sfixed64 *Int64Rules `protobuf:"bytes,12,opt,name=sfixed64,proto3,oneof"` +} + +type FieldRules_Bool struct { + // `bool` can be specified for a bool type field. + Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,proto3,oneof"` +} + +type FieldRules_String_ struct { + // `string` can be specified for a string type field. + String_ *StringRules `protobuf:"bytes,14,opt,name=string,proto3,oneof"` +} + +type FieldRules_Bytes struct { + // `bytes` can be specified for a bytes type field. + Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,proto3,oneof"` +} + +type FieldRules_Enum struct { + // `enum` can be specified for an enum type field. + Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,proto3,oneof"` +} + +type FieldRules_Message struct { + // `message` can be specified for a message type field except for the well-known types. + Message *MessageRules `protobuf:"bytes,17,opt,name=message,proto3,oneof"` +} + +func (*FieldRules_Float) isFieldRules_Type() {} + +func (*FieldRules_Double) isFieldRules_Type() {} + +func (*FieldRules_Int32) isFieldRules_Type() {} + +func (*FieldRules_Int64) isFieldRules_Type() {} + +func (*FieldRules_Uint32) isFieldRules_Type() {} + +func (*FieldRules_Uint64) isFieldRules_Type() {} + +func (*FieldRules_Sint32) isFieldRules_Type() {} + +func (*FieldRules_Sint64) isFieldRules_Type() {} + +func (*FieldRules_Fixed32) isFieldRules_Type() {} + +func (*FieldRules_Fixed64) isFieldRules_Type() {} + +func (*FieldRules_Sfixed32) isFieldRules_Type() {} + +func (*FieldRules_Sfixed64) isFieldRules_Type() {} + +func (*FieldRules_Bool) isFieldRules_Type() {} + +func (*FieldRules_String_) isFieldRules_Type() {} + +func (*FieldRules_Bytes) isFieldRules_Type() {} + +func (*FieldRules_Enum) isFieldRules_Type() {} + +func (*FieldRules_Message) isFieldRules_Type() {} + +type isFieldRules_Items interface { + isFieldRules_Items() +} + +type FieldRules_Repeated struct { + // `repeated` can be specified for any field with `repeated` specifier. + Repeated *ItemsRules `protobuf:"bytes,1000,opt,name=repeated,proto3,oneof"` +} + +type FieldRules_Map struct { + // `map` can be specified for any map type field. + Map *ItemsRules `protobuf:"bytes,1001,opt,name=map,proto3,oneof"` +} + +func (*FieldRules_Repeated) isFieldRules_Items() {} + +func (*FieldRules_Map) isFieldRules_Items() {} + +// ItemsRules are optional message to specify the constraints on the number +// of items in a repeated field or a map type. +type ItemsRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `min_items` specifies that this field must have the specified number of items at a minimum. + MinItems *uint32 `protobuf:"varint,1,opt,name=min_items,json=minItems,proto3,oneof" json:"min_items,omitempty"` + // `max_items` specifies that this field must have the specified number of items at a maximum. + MaxItems *uint32 `protobuf:"varint,2,opt,name=max_items,json=maxItems,proto3,oneof" json:"max_items,omitempty"` +} + +func (x *ItemsRules) Reset() { + *x = ItemsRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ItemsRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ItemsRules) ProtoMessage() {} + +func (x *ItemsRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ItemsRules.ProtoReflect.Descriptor instead. +func (*ItemsRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{1} +} + +func (x *ItemsRules) GetMinItems() uint32 { + if x != nil && x.MinItems != nil { + return *x.MinItems + } + return 0 +} + +func (x *ItemsRules) GetMaxItems() uint32 { + if x != nil && x.MaxItems != nil { + return *x.MaxItems + } + return 0 +} + +// FloatRules provides rules for `float` field. +type FloatRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `lt` specifies that this field must be less than the specified value. + Lt *float32 `protobuf:"fixed32,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"` + // `lte` specifies that this field must be less than or equal to the specified value. + Lte *float32 `protobuf:"fixed32,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"` + // `gt` specifies that this field must be greater than the specified value. + Gt *float32 `protobuf:"fixed32,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"` + // `gte` specifies that this field must be greater than or equal to the specified value. + Gte *float32 `protobuf:"fixed32,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"` +} + +func (x *FloatRules) Reset() { + *x = FloatRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FloatRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FloatRules) ProtoMessage() {} + +func (x *FloatRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FloatRules.ProtoReflect.Descriptor instead. +func (*FloatRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{2} +} + +func (x *FloatRules) GetLt() float32 { + if x != nil && x.Lt != nil { + return *x.Lt + } + return 0 +} + +func (x *FloatRules) GetLte() float32 { + if x != nil && x.Lte != nil { + return *x.Lte + } + return 0 +} + +func (x *FloatRules) GetGt() float32 { + if x != nil && x.Gt != nil { + return *x.Gt + } + return 0 +} + +func (x *FloatRules) GetGte() float32 { + if x != nil && x.Gte != nil { + return *x.Gte + } + return 0 +} + +// DoubleRules provides rules for `double` field. +type DoubleRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `lt` specifies that this field must be less than the specified value. + Lt *float64 `protobuf:"fixed64,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"` + // `lte` specifies that this field must be less than or equal to the specified value. + Lte *float64 `protobuf:"fixed64,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"` + // `gt` specifies that this field must be greater than the specified value. + Gt *float64 `protobuf:"fixed64,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"` + // `gte` specifies that this field must be greater than or equal to the specified value. + Gte *float64 `protobuf:"fixed64,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"` +} + +func (x *DoubleRules) Reset() { + *x = DoubleRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DoubleRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DoubleRules) ProtoMessage() {} + +func (x *DoubleRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DoubleRules.ProtoReflect.Descriptor instead. +func (*DoubleRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{3} +} + +func (x *DoubleRules) GetLt() float64 { + if x != nil && x.Lt != nil { + return *x.Lt + } + return 0 +} + +func (x *DoubleRules) GetLte() float64 { + if x != nil && x.Lte != nil { + return *x.Lte + } + return 0 +} + +func (x *DoubleRules) GetGt() float64 { + if x != nil && x.Gt != nil { + return *x.Gt + } + return 0 +} + +func (x *DoubleRules) GetGte() float64 { + if x != nil && x.Gte != nil { + return *x.Gte + } + return 0 +} + +// Int32Rules provides rules for `int32`, `sint32`, `sfixed32` fields. +type Int32Rules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `lt` specifies that this field must be less than the specified value. + Lt *int32 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"` + // `lte` specifies that this field must be less than or equal to the specified value. + Lte *int32 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"` + // `gt` specifies that this field must be greater than the specified value. + Gt *int32 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"` + // `gte` specifies that this field must be greater than or equal to the specified value. + Gte *int32 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"` +} + +func (x *Int32Rules) Reset() { + *x = Int32Rules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Int32Rules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Int32Rules) ProtoMessage() {} + +func (x *Int32Rules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Int32Rules.ProtoReflect.Descriptor instead. +func (*Int32Rules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{4} +} + +func (x *Int32Rules) GetLt() int32 { + if x != nil && x.Lt != nil { + return *x.Lt + } + return 0 +} + +func (x *Int32Rules) GetLte() int32 { + if x != nil && x.Lte != nil { + return *x.Lte + } + return 0 +} + +func (x *Int32Rules) GetGt() int32 { + if x != nil && x.Gt != nil { + return *x.Gt + } + return 0 +} + +func (x *Int32Rules) GetGte() int32 { + if x != nil && x.Gte != nil { + return *x.Gte + } + return 0 +} + +// Int64Rules provides rules for `int64`, `sint64`, `sfixed64` fields. +type Int64Rules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `lt` specifies that this field must be less than the specified value. + Lt *int64 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"` + // `lte` specifies that this field must be less than or equal to the specified value. + Lte *int64 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"` + // `gt` specifies that this field must be greater than the specified value. + Gt *int64 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"` + // `gte` specifies that this field must be greater than or equal to the specified value. + Gte *int64 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"` +} + +func (x *Int64Rules) Reset() { + *x = Int64Rules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Int64Rules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Int64Rules) ProtoMessage() {} + +func (x *Int64Rules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Int64Rules.ProtoReflect.Descriptor instead. +func (*Int64Rules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{5} +} + +func (x *Int64Rules) GetLt() int64 { + if x != nil && x.Lt != nil { + return *x.Lt + } + return 0 +} + +func (x *Int64Rules) GetLte() int64 { + if x != nil && x.Lte != nil { + return *x.Lte + } + return 0 +} + +func (x *Int64Rules) GetGt() int64 { + if x != nil && x.Gt != nil { + return *x.Gt + } + return 0 +} + +func (x *Int64Rules) GetGte() int64 { + if x != nil && x.Gte != nil { + return *x.Gte + } + return 0 +} + +// Uint32Rules provides rules for `uint32` and `fixed32` fields. +type Uint32Rules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `lt` specifies that this field must be less than the specified value. + Lt *uint32 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"` + // `lte` specifies that this field must be less than or equal to the specified value. + Lte *uint32 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"` + // `gt` specifies that this field must be greater than the specified value. + Gt *uint32 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"` + // `gte` specifies that this field must be greater than or equal to the specified value. + Gte *uint32 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"` +} + +func (x *Uint32Rules) Reset() { + *x = Uint32Rules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Uint32Rules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Uint32Rules) ProtoMessage() {} + +func (x *Uint32Rules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Uint32Rules.ProtoReflect.Descriptor instead. +func (*Uint32Rules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{6} +} + +func (x *Uint32Rules) GetLt() uint32 { + if x != nil && x.Lt != nil { + return *x.Lt + } + return 0 +} + +func (x *Uint32Rules) GetLte() uint32 { + if x != nil && x.Lte != nil { + return *x.Lte + } + return 0 +} + +func (x *Uint32Rules) GetGt() uint32 { + if x != nil && x.Gt != nil { + return *x.Gt + } + return 0 +} + +func (x *Uint32Rules) GetGte() uint32 { + if x != nil && x.Gte != nil { + return *x.Gte + } + return 0 +} + +// Uint64Rules provides rules for `uint64` and `fixed64` fields. +type Uint64Rules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `lt` specifies that this field must be less than the specified value. + Lt *uint64 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"` + // `lte` specifies that this field must be less than or equal to the specified value. + Lte *uint64 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"` + // `gt` specifies that this field must be greater than the specified value. + Gt *uint64 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"` + // `gte` specifies that this field must be greater than or equal to the specified value. + Gte *uint64 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"` +} + +func (x *Uint64Rules) Reset() { + *x = Uint64Rules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Uint64Rules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Uint64Rules) ProtoMessage() {} + +func (x *Uint64Rules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Uint64Rules.ProtoReflect.Descriptor instead. +func (*Uint64Rules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{7} +} + +func (x *Uint64Rules) GetLt() uint64 { + if x != nil && x.Lt != nil { + return *x.Lt + } + return 0 +} + +func (x *Uint64Rules) GetLte() uint64 { + if x != nil && x.Lte != nil { + return *x.Lte + } + return 0 +} + +func (x *Uint64Rules) GetGt() uint64 { + if x != nil && x.Gt != nil { + return *x.Gt + } + return 0 +} + +func (x *Uint64Rules) GetGte() uint64 { + if x != nil && x.Gte != nil { + return *x.Gte + } + return 0 +} + +// BoolRules provides rules for `bool` field. +// Currently, no rule is available. +type BoolRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *BoolRules) Reset() { + *x = BoolRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BoolRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BoolRules) ProtoMessage() {} + +func (x *BoolRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BoolRules.ProtoReflect.Descriptor instead. +func (*BoolRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{8} +} + +// StringRules provides rules for `string` field. +type StringRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `norm` specifies which normalization is to be applied to the string. + // By default, strings are normalized into the NFC form. + Norm StringRules_UnicodeNormalizationForm `protobuf:"varint,1,opt,name=norm,proto3,enum=cybozu.validate.StringRules_UnicodeNormalizationForm" json:"norm,omitempty"` + // `ignore_empty` specifies whether to ignore validation rules when the string is empty. + IgnoreEmpty bool `protobuf:"varint,2,opt,name=ignore_empty,json=ignoreEmpty,proto3" json:"ignore_empty,omitempty"` + // `min_length` specifies the minimum string length. + // The length is counted as the number of UNICODE codepoints after normalization is applied. + MinLength *uint32 `protobuf:"varint,3,opt,name=min_length,json=minLength,proto3,oneof" json:"min_length,omitempty"` + // `max_length` specifies the maximum string length. + // The length is counted as the number of UNICODE codepoints after normalization is applied. + MaxLength *uint32 `protobuf:"varint,4,opt,name=max_length,json=maxLength,proto3,oneof" json:"max_length,omitempty"` + // `regex` specifies a regular expression that the string must match. + // The syntax of the regular expression is the same as google/re2. + // https://github.com/google/re2/wiki/Syntax + Regex *string `protobuf:"bytes,5,opt,name=regex,proto3,oneof" json:"regex,omitempty"` + // For convenience, one of the following well-known pattern can be specified. + // + // Types that are assignable to Predefined: + // + // *StringRules_Email + // *StringRules_Uri + // *StringRules_E164 + Predefined isStringRules_Predefined `protobuf_oneof:"predefined"` +} + +func (x *StringRules) Reset() { + *x = StringRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StringRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StringRules) ProtoMessage() {} + +func (x *StringRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StringRules.ProtoReflect.Descriptor instead. +func (*StringRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{9} +} + +func (x *StringRules) GetNorm() StringRules_UnicodeNormalizationForm { + if x != nil { + return x.Norm + } + return StringRules_NFC +} + +func (x *StringRules) GetIgnoreEmpty() bool { + if x != nil { + return x.IgnoreEmpty + } + return false +} + +func (x *StringRules) GetMinLength() uint32 { + if x != nil && x.MinLength != nil { + return *x.MinLength + } + return 0 +} + +func (x *StringRules) GetMaxLength() uint32 { + if x != nil && x.MaxLength != nil { + return *x.MaxLength + } + return 0 +} + +func (x *StringRules) GetRegex() string { + if x != nil && x.Regex != nil { + return *x.Regex + } + return "" +} + +func (m *StringRules) GetPredefined() isStringRules_Predefined { + if m != nil { + return m.Predefined + } + return nil +} + +func (x *StringRules) GetEmail() bool { + if x, ok := x.GetPredefined().(*StringRules_Email); ok { + return x.Email + } + return false +} + +func (x *StringRules) GetUri() bool { + if x, ok := x.GetPredefined().(*StringRules_Uri); ok { + return x.Uri + } + return false +} + +func (x *StringRules) GetE164() bool { + if x, ok := x.GetPredefined().(*StringRules_E164); ok { + return x.E164 + } + return false +} + +type isStringRules_Predefined interface { + isStringRules_Predefined() +} + +type StringRules_Email struct { + // `email` specifies that the field must be canonicalized and validated as an email address as defined by Section 3.4.1 in RFC 5322. + // See https://www.rfc-editor.org/rfc/rfc5322#section-3.4.1 + Email bool `protobuf:"varint,100,opt,name=email,proto3,oneof"` +} + +type StringRules_Uri struct { + // `uri` specifies that the field must be canonicalized and validated as an absolute URI as defined by RFC 3986. + Uri bool `protobuf:"varint,101,opt,name=uri,proto3,oneof"` +} + +type StringRules_E164 struct { + // `e164` specifies that the field must be canonicalized and validated as a telephone number as defined by E.164 + // with a prefixing `+` sign and optional hyphen separators. E.g., "+81-3-1111-1111". + // See https://en.wikipedia.org/wiki/E.164 + E164 bool `protobuf:"varint,102,opt,name=e164,proto3,oneof"` +} + +func (*StringRules_Email) isStringRules_Predefined() {} + +func (*StringRules_Uri) isStringRules_Predefined() {} + +func (*StringRules_E164) isStringRules_Predefined() {} + +// BytesRules provides rules for `bytes` field. +type BytesRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `min_length` specifies the minimum length. + // The length is counted as the number of bytes. + MinLength *uint32 `protobuf:"varint,3,opt,name=min_length,json=minLength,proto3,oneof" json:"min_length,omitempty"` + // `max_length` specifies the maximum length. + // The length is counted as the number of bytes. + MaxLength *uint32 `protobuf:"varint,4,opt,name=max_length,json=maxLength,proto3,oneof" json:"max_length,omitempty"` +} + +func (x *BytesRules) Reset() { + *x = BytesRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BytesRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BytesRules) ProtoMessage() {} + +func (x *BytesRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BytesRules.ProtoReflect.Descriptor instead. +func (*BytesRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{10} +} + +func (x *BytesRules) GetMinLength() uint32 { + if x != nil && x.MinLength != nil { + return *x.MinLength + } + return 0 +} + +func (x *BytesRules) GetMaxLength() uint32 { + if x != nil && x.MaxLength != nil { + return *x.MaxLength + } + return 0 +} + +// EnumRules provides rules for `enum` field. +type EnumRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `required` specifies that this field must not be zero (usually, zero means unspecified). + Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` + // `defined_only` specifies that this field must be only one of the defined + // values for this enum, failing on any undefined value. + DefinedOnly bool `protobuf:"varint,2,opt,name=defined_only,json=definedOnly,proto3" json:"defined_only,omitempty"` +} + +func (x *EnumRules) Reset() { + *x = EnumRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumRules) ProtoMessage() {} + +func (x *EnumRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumRules.ProtoReflect.Descriptor instead. +func (*EnumRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{11} +} + +func (x *EnumRules) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +func (x *EnumRules) GetDefinedOnly() bool { + if x != nil { + return x.DefinedOnly + } + return false +} + +// MessageRules provides rules for `message` field. +// For a message field, validation/normalization will be done recursively. +type MessageRules struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // `required` specifies that this field must be set. + Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"` +} + +func (x *MessageRules) Reset() { + *x = MessageRules{} + if protoimpl.UnsafeEnabled { + mi := &file_cybozu_validate_options_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageRules) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageRules) ProtoMessage() {} + +func (x *MessageRules) ProtoReflect() protoreflect.Message { + mi := &file_cybozu_validate_options_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageRules.ProtoReflect.Descriptor instead. +func (*MessageRules) Descriptor() ([]byte, []int) { + return file_cybozu_validate_options_proto_rawDescGZIP(), []int{12} +} + +func (x *MessageRules) GetRequired() bool { + if x != nil { + return x.Required + } + return false +} + +var file_cybozu_validate_options_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 401000, + Name: "cybozu.validate.ignored", + Tag: "varint,401000,opt,name=ignored", + Filename: "cybozu/validate/options.proto", + }, + { + ExtendedType: (*descriptorpb.OneofOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 401000, + Name: "cybozu.validate.required", + Tag: "varint,401000,opt,name=required", + Filename: "cybozu/validate/options.proto", + }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*FieldRules)(nil), + Field: 401000, + Name: "cybozu.validate.rules", + Tag: "bytes,401000,opt,name=rules", + Filename: "cybozu/validate/options.proto", + }, +} + +// Extension fields to descriptorpb.MessageOptions. +var ( + // `ignored` stops generating `Validate()` method for this message. + // + // optional bool ignored = 401000; + E_Ignored = &file_cybozu_validate_options_proto_extTypes[0] +) + +// Extension fields to descriptorpb.OneofOptions. +var ( + // `required` ensures that a field in this oneof is set. + // + // optional bool required = 401000; + E_Required = &file_cybozu_validate_options_proto_extTypes[1] +) + +// Extension fields to descriptorpb.FieldOptions. +var ( + // `rules` specify the validations/normalizations to be performed on this field. + // Note that a string field will always be normalized to the UNICODE NFC form + // even if there is no rule specified. + // + // optional cybozu.validate.FieldRules rules = 401000; + E_Rules = &file_cybozu_validate_options_proto_extTypes[2] +) + +var File_cybozu_validate_options_proto protoreflect.FileDescriptor + +var file_cybozu_validate_options_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0f, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xb6, 0x08, 0x0a, 0x0a, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x75, 0x6c, 0x65, + 0x73, 0x12, 0x33, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2e, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, + 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x36, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, + 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x12, 0x33, + 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x12, 0x33, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, + 0x00, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x36, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, + 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x33, + 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x12, 0x36, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, + 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, + 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, + 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, + 0x35, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x06, + 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x38, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, + 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, + 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, + 0x12, 0x38, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, + 0x00, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x39, 0x0a, 0x08, 0x73, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, + 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x49, + 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x08, 0x73, 0x66, 0x69, + 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x39, 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, + 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, + 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x52, + 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, + 0x12, 0x30, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x04, 0x62, 0x6f, + 0x6f, 0x6c, 0x12, 0x36, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, + 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x33, 0x0a, 0x05, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, + 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x30, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x00, 0x52, 0x04, 0x65, 0x6e, 0x75, + 0x6d, 0x12, 0x39, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x75, 0x6c, 0x65, + 0x73, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x08, + 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x48, 0x01, 0x52, 0x08, + 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x30, 0x0a, 0x03, 0x6d, 0x61, 0x70, 0x18, + 0xe9, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x75, + 0x6c, 0x65, 0x73, 0x48, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x70, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x6c, 0x0a, 0x0a, 0x49, + 0x74, 0x65, 0x6d, 0x73, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x09, 0x6d, 0x69, 0x6e, + 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x08, + 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x6d, + 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, + 0x0a, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x0a, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x02, 0x48, 0x00, 0x52, 0x02, 0x6c, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, + 0x03, 0x6c, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x48, 0x01, 0x52, 0x03, 0x6c, 0x74, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x13, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, + 0x48, 0x02, 0x52, 0x02, 0x67, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x67, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x48, 0x03, 0x52, 0x03, 0x67, 0x74, 0x65, 0x88, 0x01, 0x01, + 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x6c, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6c, 0x74, 0x65, 0x42, + 0x05, 0x0a, 0x03, 0x5f, 0x67, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x67, 0x74, 0x65, 0x22, 0x83, + 0x01, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x13, + 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00, 0x52, 0x02, 0x6c, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, + 0x48, 0x01, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x88, 0x01, 0x01, 0x12, 0x13, 0x0a, 0x02, 0x67, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x48, 0x02, 0x52, 0x02, 0x67, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x15, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x48, 0x03, 0x52, 0x03, + 0x67, 0x74, 0x65, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x6c, 0x74, 0x42, 0x06, 0x0a, + 0x04, 0x5f, 0x6c, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x67, 0x74, 0x42, 0x06, 0x0a, 0x04, + 0x5f, 0x67, 0x74, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, + 0x6c, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, + 0x00, 0x52, 0x02, 0x6c, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x13, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x02, 0x67, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x48, 0x03, 0x52, 0x03, 0x67, 0x74, 0x65, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, + 0x6c, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6c, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x67, + 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x67, 0x74, 0x65, 0x22, 0x82, 0x01, 0x0a, 0x0a, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x02, 0x6c, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, + 0x03, 0x6c, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x03, 0x6c, 0x74, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x13, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x48, 0x02, 0x52, 0x02, 0x67, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x67, 0x74, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x48, 0x03, 0x52, 0x03, 0x67, 0x74, 0x65, 0x88, 0x01, 0x01, + 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x6c, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6c, 0x74, 0x65, 0x42, + 0x05, 0x0a, 0x03, 0x5f, 0x67, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x67, 0x74, 0x65, 0x22, 0x83, + 0x01, 0x0a, 0x0b, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x13, + 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x02, 0x6c, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6c, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x88, 0x01, 0x01, 0x12, 0x13, 0x0a, 0x02, 0x67, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x02, 0x67, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x15, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, 0x03, + 0x67, 0x74, 0x65, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x6c, 0x74, 0x42, 0x06, 0x0a, + 0x04, 0x5f, 0x6c, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x67, 0x74, 0x42, 0x06, 0x0a, 0x04, + 0x5f, 0x67, 0x74, 0x65, 0x22, 0x83, 0x01, 0x0a, 0x0b, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, + 0x75, 0x6c, 0x65, 0x73, 0x12, 0x13, 0x0a, 0x02, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x48, 0x00, 0x52, 0x02, 0x6c, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6c, 0x74, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x03, 0x6c, 0x74, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x13, 0x0a, 0x02, 0x67, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x02, 0x52, 0x02, + 0x67, 0x74, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x67, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x48, 0x03, 0x52, 0x03, 0x67, 0x74, 0x65, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, + 0x5f, 0x6c, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6c, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x5f, + 0x67, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x67, 0x74, 0x65, 0x22, 0x0b, 0x0a, 0x09, 0x42, 0x6f, + 0x6f, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x22, 0xf8, 0x03, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x04, 0x6e, 0x6f, 0x72, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2e, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x75, + 0x6c, 0x65, 0x73, 0x2e, 0x55, 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, + 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x52, 0x04, 0x6e, 0x6f, + 0x72, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x65, 0x6d, 0x70, + 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x09, 0x6d, 0x69, 0x6e, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0a, 0x6d, 0x61, 0x78, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x05, + 0x72, 0x65, 0x67, 0x65, 0x78, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x18, 0x64, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, + 0x12, 0x12, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x65, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, + 0x03, 0x75, 0x72, 0x69, 0x12, 0x14, 0x0a, 0x04, 0x65, 0x31, 0x36, 0x34, 0x18, 0x66, 0x20, 0x01, + 0x28, 0x08, 0x48, 0x00, 0x52, 0x04, 0x65, 0x31, 0x36, 0x34, 0x22, 0x9f, 0x01, 0x0a, 0x18, 0x55, + 0x6e, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x46, 0x43, 0x10, 0x00, + 0x12, 0x07, 0x0a, 0x03, 0x4e, 0x46, 0x44, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x46, 0x4b, + 0x43, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x46, 0x4b, 0x44, 0x10, 0x03, 0x12, 0x1f, 0x0a, + 0x1b, 0x50, 0x52, 0x45, 0x43, 0x49, 0x53, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x4e, 0x41, 0x4d, 0x45, + 0x5f, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x45, 0x44, 0x10, 0x64, 0x12, 0x22, + 0x0a, 0x1e, 0x50, 0x52, 0x45, 0x43, 0x49, 0x53, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x4e, 0x41, 0x4d, + 0x45, 0x5f, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x52, 0x56, 0x45, 0x44, + 0x10, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x52, 0x45, 0x43, 0x49, 0x53, 0x5f, 0x4f, 0x50, 0x41, + 0x51, 0x55, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x66, 0x42, 0x0c, 0x0a, 0x0a, + 0x70, 0x72, 0x65, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6d, + 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6d, 0x61, + 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x72, 0x65, 0x67, + 0x65, 0x78, 0x22, 0x72, 0x0a, 0x0a, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x75, 0x6c, 0x65, 0x73, + 0x12, 0x22, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6d, 0x69, 0x6e, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6d, 0x61, 0x78, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x4a, 0x0a, 0x09, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x75, + 0x6c, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, + 0x21, 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x4f, 0x6e, + 0x6c, 0x79, 0x22, 0x2a, 0x0a, 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x75, 0x6c, + 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x3a, 0x3b, + 0x0a, 0x07, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe8, 0xbc, 0x18, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x3a, 0x3b, 0x0a, 0x08, 0x72, + 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe8, 0xbc, 0x18, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, + 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x3a, 0x52, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, + 0x73, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0xe8, 0xbc, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x79, 0x62, 0x6f, 0x7a, + 0x75, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x52, 0x75, 0x6c, 0x65, 0x73, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x2c, 0x5a, 0x2a, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x79, 0x62, 0x6f, 0x7a, + 0x75, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x63, 0x79, 0x62, 0x6f, 0x7a, + 0x75, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_cybozu_validate_options_proto_rawDescOnce sync.Once + file_cybozu_validate_options_proto_rawDescData = file_cybozu_validate_options_proto_rawDesc +) + +func file_cybozu_validate_options_proto_rawDescGZIP() []byte { + file_cybozu_validate_options_proto_rawDescOnce.Do(func() { + file_cybozu_validate_options_proto_rawDescData = protoimpl.X.CompressGZIP(file_cybozu_validate_options_proto_rawDescData) + }) + return file_cybozu_validate_options_proto_rawDescData +} + +var file_cybozu_validate_options_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_cybozu_validate_options_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_cybozu_validate_options_proto_goTypes = []interface{}{ + (StringRules_UnicodeNormalizationForm)(0), // 0: cybozu.validate.StringRules.UnicodeNormalizationForm + (*FieldRules)(nil), // 1: cybozu.validate.FieldRules + (*ItemsRules)(nil), // 2: cybozu.validate.ItemsRules + (*FloatRules)(nil), // 3: cybozu.validate.FloatRules + (*DoubleRules)(nil), // 4: cybozu.validate.DoubleRules + (*Int32Rules)(nil), // 5: cybozu.validate.Int32Rules + (*Int64Rules)(nil), // 6: cybozu.validate.Int64Rules + (*Uint32Rules)(nil), // 7: cybozu.validate.Uint32Rules + (*Uint64Rules)(nil), // 8: cybozu.validate.Uint64Rules + (*BoolRules)(nil), // 9: cybozu.validate.BoolRules + (*StringRules)(nil), // 10: cybozu.validate.StringRules + (*BytesRules)(nil), // 11: cybozu.validate.BytesRules + (*EnumRules)(nil), // 12: cybozu.validate.EnumRules + (*MessageRules)(nil), // 13: cybozu.validate.MessageRules + (*descriptorpb.MessageOptions)(nil), // 14: google.protobuf.MessageOptions + (*descriptorpb.OneofOptions)(nil), // 15: google.protobuf.OneofOptions + (*descriptorpb.FieldOptions)(nil), // 16: google.protobuf.FieldOptions +} +var file_cybozu_validate_options_proto_depIdxs = []int32{ + 3, // 0: cybozu.validate.FieldRules.float:type_name -> cybozu.validate.FloatRules + 4, // 1: cybozu.validate.FieldRules.double:type_name -> cybozu.validate.DoubleRules + 5, // 2: cybozu.validate.FieldRules.int32:type_name -> cybozu.validate.Int32Rules + 6, // 3: cybozu.validate.FieldRules.int64:type_name -> cybozu.validate.Int64Rules + 7, // 4: cybozu.validate.FieldRules.uint32:type_name -> cybozu.validate.Uint32Rules + 8, // 5: cybozu.validate.FieldRules.uint64:type_name -> cybozu.validate.Uint64Rules + 5, // 6: cybozu.validate.FieldRules.sint32:type_name -> cybozu.validate.Int32Rules + 6, // 7: cybozu.validate.FieldRules.sint64:type_name -> cybozu.validate.Int64Rules + 7, // 8: cybozu.validate.FieldRules.fixed32:type_name -> cybozu.validate.Uint32Rules + 8, // 9: cybozu.validate.FieldRules.fixed64:type_name -> cybozu.validate.Uint64Rules + 5, // 10: cybozu.validate.FieldRules.sfixed32:type_name -> cybozu.validate.Int32Rules + 6, // 11: cybozu.validate.FieldRules.sfixed64:type_name -> cybozu.validate.Int64Rules + 9, // 12: cybozu.validate.FieldRules.bool:type_name -> cybozu.validate.BoolRules + 10, // 13: cybozu.validate.FieldRules.string:type_name -> cybozu.validate.StringRules + 11, // 14: cybozu.validate.FieldRules.bytes:type_name -> cybozu.validate.BytesRules + 12, // 15: cybozu.validate.FieldRules.enum:type_name -> cybozu.validate.EnumRules + 13, // 16: cybozu.validate.FieldRules.message:type_name -> cybozu.validate.MessageRules + 2, // 17: cybozu.validate.FieldRules.repeated:type_name -> cybozu.validate.ItemsRules + 2, // 18: cybozu.validate.FieldRules.map:type_name -> cybozu.validate.ItemsRules + 0, // 19: cybozu.validate.StringRules.norm:type_name -> cybozu.validate.StringRules.UnicodeNormalizationForm + 14, // 20: cybozu.validate.ignored:extendee -> google.protobuf.MessageOptions + 15, // 21: cybozu.validate.required:extendee -> google.protobuf.OneofOptions + 16, // 22: cybozu.validate.rules:extendee -> google.protobuf.FieldOptions + 1, // 23: cybozu.validate.rules:type_name -> cybozu.validate.FieldRules + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 23, // [23:24] is the sub-list for extension type_name + 20, // [20:23] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name +} + +func init() { file_cybozu_validate_options_proto_init() } +func file_cybozu_validate_options_proto_init() { + if File_cybozu_validate_options_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cybozu_validate_options_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ItemsRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FloatRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DoubleRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Int32Rules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Int64Rules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Uint32Rules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Uint64Rules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BoolRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StringRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BytesRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cybozu_validate_options_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageRules); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_cybozu_validate_options_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*FieldRules_Float)(nil), + (*FieldRules_Double)(nil), + (*FieldRules_Int32)(nil), + (*FieldRules_Int64)(nil), + (*FieldRules_Uint32)(nil), + (*FieldRules_Uint64)(nil), + (*FieldRules_Sint32)(nil), + (*FieldRules_Sint64)(nil), + (*FieldRules_Fixed32)(nil), + (*FieldRules_Fixed64)(nil), + (*FieldRules_Sfixed32)(nil), + (*FieldRules_Sfixed64)(nil), + (*FieldRules_Bool)(nil), + (*FieldRules_String_)(nil), + (*FieldRules_Bytes)(nil), + (*FieldRules_Enum)(nil), + (*FieldRules_Message)(nil), + (*FieldRules_Repeated)(nil), + (*FieldRules_Map)(nil), + } + file_cybozu_validate_options_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[2].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[3].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[4].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[5].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[6].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[7].OneofWrappers = []interface{}{} + file_cybozu_validate_options_proto_msgTypes[9].OneofWrappers = []interface{}{ + (*StringRules_Email)(nil), + (*StringRules_Uri)(nil), + (*StringRules_E164)(nil), + } + file_cybozu_validate_options_proto_msgTypes[10].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cybozu_validate_options_proto_rawDesc, + NumEnums: 1, + NumMessages: 13, + NumExtensions: 3, + NumServices: 0, + }, + GoTypes: file_cybozu_validate_options_proto_goTypes, + DependencyIndexes: file_cybozu_validate_options_proto_depIdxs, + EnumInfos: file_cybozu_validate_options_proto_enumTypes, + MessageInfos: file_cybozu_validate_options_proto_msgTypes, + ExtensionInfos: file_cybozu_validate_options_proto_extTypes, + }.Build() + File_cybozu_validate_options_proto = out.File + file_cybozu_validate_options_proto_rawDesc = nil + file_cybozu_validate_options_proto_goTypes = nil + file_cybozu_validate_options_proto_depIdxs = nil +} diff --git a/cybozu/validate/options.proto b/cybozu/validate/options.proto new file mode 100644 index 0000000..ad709fd --- /dev/null +++ b/cybozu/validate/options.proto @@ -0,0 +1,299 @@ +syntax = "proto3"; + +// Custom extensions to generate code for gRPC request validation/normalization. +// +// The custom options defined here are: +// - `cybozu.validate.ignored` message option. +// - `cybozu.validate.required` oneof option. +// - `cybozu.validate.rules` field option. +// +// To generate normalization/validation code, use `protoc-gen-$LANG-cybozu-validate` +// for the target language. +package cybozu.validate; + +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/cybozu/protobuf/cybozu/validate"; + +extend google.protobuf.MessageOptions { + // `ignored` stops generating `Validate()` method for this message. + bool ignored = 401000; +} + +extend google.protobuf.OneofOptions { + // `required` ensures that a field in this oneof is set. + bool required = 401000; +} + +extend google.protobuf.FieldOptions { + // `rules` specify the validations/normalizations to be performed on this field. + // Note that a string field will always be normalized to the UNICODE NFC form + // even if there is no rule specified. + FieldRules rules = 401000; +} + +// FieldRules encapsulates the rules for each type of field. +// Depending on the field type, one or two rule sets can be specified. +message FieldRules { + // One of these constraints can be specified for a field. + // + // If the field is `optional` and not set, the specified rule will not be applied. + // For a map type field like `map`, you may specify a rule for the value type, here `int64`. + oneof type { + // `float` can be specified for a float type field. + FloatRules float = 1; + + // `double` can be specified for a double type field. + DoubleRules double = 2; + + // `int32` can be specified for an int32 type field. + Int32Rules int32 = 3; + + // `int64` can be specified for an int64 type field. + Int64Rules int64 = 4; + + // `uint32` can be specified for a uint32 type field. + Uint32Rules uint32 = 5; + + // `uint64` can be specified for a uint64 type field. + Uint64Rules uint64 = 6; + + // `sint32` can be specified for a sint32 type field. + Int32Rules sint32 = 7; + + // `sint64` can be specified for a sint64 type field. + Int64Rules sint64 = 8; + + // `fixed32` can be specified for a fixed32 type field. + Uint32Rules fixed32 = 9; + + // `fixed64` can be specified for a fixed64 type field. + Uint64Rules fixed64 = 10; + + // `sfixed32` can be specified for an sfixed32 type field. + Int32Rules sfixed32 = 11; + + // `sfixed64` can be specified for an sfixed64 type field. + Int64Rules sfixed64 = 12; + + // `bool` can be specified for a bool type field. + BoolRules bool = 13; + + // `string` can be specified for a string type field. + StringRules string = 14; + + // `bytes` can be specified for a bytes type field. + BytesRules bytes = 15; + + // `enum` can be specified for an enum type field. + EnumRules enum = 16; + + // `message` can be specified for a message type field except for the well-known types. + MessageRules message = 17; + } + + // One of these constraints can be specified for a repeated field or a map field. + oneof items { + // `repeated` can be specified for any field with `repeated` specifier. + ItemsRules repeated = 1000; + + // `map` can be specified for any map type field. + ItemsRules map = 1001; + } +} + +// ItemsRules are optional message to specify the constraints on the number +// of items in a repeated field or a map type. +message ItemsRules { + // `min_items` specifies that this field must have the specified number of items at a minimum. + optional uint32 min_items = 1; + + // `max_items` specifies that this field must have the specified number of items at a maximum. + optional uint32 max_items = 2; +} + +// FloatRules provides rules for `float` field. +message FloatRules { + // `lt` specifies that this field must be less than the specified value. + optional float lt = 1; + + // `lte` specifies that this field must be less than or equal to the specified value. + optional float lte = 2; + + // `gt` specifies that this field must be greater than the specified value. + optional float gt = 3; + + // `gte` specifies that this field must be greater than or equal to the specified value. + optional float gte = 4; +} + +// DoubleRules provides rules for `double` field. +message DoubleRules { + // `lt` specifies that this field must be less than the specified value. + optional double lt = 1; + + // `lte` specifies that this field must be less than or equal to the specified value. + optional double lte = 2; + + // `gt` specifies that this field must be greater than the specified value. + optional double gt = 3; + + // `gte` specifies that this field must be greater than or equal to the specified value. + optional double gte = 4; +} + +// Int32Rules provides rules for `int32`, `sint32`, `sfixed32` fields. +message Int32Rules { + // `lt` specifies that this field must be less than the specified value. + optional int32 lt = 1; + + // `lte` specifies that this field must be less than or equal to the specified value. + optional int32 lte = 2; + + // `gt` specifies that this field must be greater than the specified value. + optional int32 gt = 3; + + // `gte` specifies that this field must be greater than or equal to the specified value. + optional int32 gte = 4; +} + +// Int64Rules provides rules for `int64`, `sint64`, `sfixed64` fields. +message Int64Rules { + // `lt` specifies that this field must be less than the specified value. + optional int64 lt = 1; + + // `lte` specifies that this field must be less than or equal to the specified value. + optional int64 lte = 2; + + // `gt` specifies that this field must be greater than the specified value. + optional int64 gt = 3; + + // `gte` specifies that this field must be greater than or equal to the specified value. + optional int64 gte = 4; +} + +// Uint32Rules provides rules for `uint32` and `fixed32` fields. +message Uint32Rules { + // `lt` specifies that this field must be less than the specified value. + optional uint32 lt = 1; + + // `lte` specifies that this field must be less than or equal to the specified value. + optional uint32 lte = 2; + + // `gt` specifies that this field must be greater than the specified value. + optional uint32 gt = 3; + + // `gte` specifies that this field must be greater than or equal to the specified value. + optional uint32 gte = 4; +} + +// Uint64Rules provides rules for `uint64` and `fixed64` fields. +message Uint64Rules { + // `lt` specifies that this field must be less than the specified value. + optional uint64 lt = 1; + + // `lte` specifies that this field must be less than or equal to the specified value. + optional uint64 lte = 2; + + // `gt` specifies that this field must be greater than the specified value. + optional uint64 gt = 3; + + // `gte` specifies that this field must be greater than or equal to the specified value. + optional uint64 gte = 4; +} + +// BoolRules provides rules for `bool` field. +// Currently, no rule is available. +message BoolRules {} + +// StringRules provides rules for `string` field. +message StringRules { + // UNICODE normalization forms. + // In addition to the forms defined by https://www.unicode.org/reports/tr15/, + // we include PRECIS profiles as they are considered a variant of the NFC form. + enum UnicodeNormalizationForm { + // NFC form as defined by https://www.unicode.org/reports/tr15/ + NFC = 0; + + // NFD form as defined by https://www.unicode.org/reports/tr15/ + NFD = 1; + + // NFKC form as defined by https://www.unicode.org/reports/tr15/ + NFKC = 2; + + // NFKD form as defined by https://www.unicode.org/reports/tr15/ + NFKD = 3; + + // PRECIS UsernameCaseMapped profile as defined by RFC 8265 + PRECIS_USERNAME_CASE_MAPPED = 100; + + // PRECIS UsernameCasePreserved profile as defined by RFC 8265 + PRECIS_USERNAME_CASE_PRESERVED = 101; + + // PRECIS OpaqueString profile as defined by RFC 8265 + PRECIS_OPAQUE_STRING = 102; + } + + // `norm` specifies which normalization is to be applied to the string. + // By default, strings are normalized into the NFC form. + UnicodeNormalizationForm norm = 1; + + // `ignore_empty` specifies whether to ignore validation rules when the string is empty. + bool ignore_empty = 2; + + // `min_length` specifies the minimum string length. + // The length is counted as the number of UNICODE codepoints after normalization is applied. + optional uint32 min_length = 3; + + // `max_length` specifies the maximum string length. + // The length is counted as the number of UNICODE codepoints after normalization is applied. + optional uint32 max_length = 4; + + // `regex` specifies a regular expression that the string must match. + // The syntax of the regular expression is the same as google/re2. + // https://github.com/google/re2/wiki/Syntax + optional string regex = 5; + + // For convenience, one of the following well-known pattern can be specified. + oneof predefined { + // `email` specifies that the field must be canonicalized and validated as an email address as defined by Section 3.4.1 in RFC 5322. + // See https://www.rfc-editor.org/rfc/rfc5322#section-3.4.1 + bool email = 100; + + // `uri` specifies that the field must be canonicalized and validated as an absolute URI as defined by RFC 3986. + bool uri = 101; + + // `e164` specifies that the field must be canonicalized and validated as a telephone number as defined by E.164 + // with a prefixing `+` sign and optional hyphen separators. E.g., "+81-3-1111-1111". + // See https://en.wikipedia.org/wiki/E.164 + bool e164 = 102; + } +} + +// BytesRules provides rules for `bytes` field. +message BytesRules { + // `min_length` specifies the minimum length. + // The length is counted as the number of bytes. + optional uint32 min_length = 3; + + // `max_length` specifies the maximum length. + // The length is counted as the number of bytes. + optional uint32 max_length = 4; +} + +// EnumRules provides rules for `enum` field. +message EnumRules { + // `required` specifies that this field must not be zero (usually, zero means unspecified). + bool required = 1; + + // `defined_only` specifies that this field must be only one of the defined + // values for this enum, failing on any undefined value. + bool defined_only = 2; +} + +// MessageRules provides rules for `message` field. +// For a message field, validation/normalization will be done recursively. +message MessageRules { + // `required` specifies that this field must be set. + bool required = 1; +} diff --git a/cybozu/validate/validate.go b/cybozu/validate/validate.go new file mode 100644 index 0000000..c3c7188 --- /dev/null +++ b/cybozu/validate/validate.go @@ -0,0 +1,31 @@ +package validate + +import "regexp" + +// E164Pattern is a regular expression to match E.164 telephone number format. +var E164Pattern = regexp.MustCompile(`^\+[1-9][0-9-]+$`) + +// CustomValidator is the interface that a message struct can optionally implement. +// The generated `Validate()` function will call `ValidateCustom()` from inside +// if available. +type CustomValidator interface { + ValidateCustom() error +} + +// CallValidate calls `Validate() error` function if `m` implements it. +func CallValidate(m any) error { + v, ok := m.(interface{ Validate() error }) + if !ok { + return nil + } + return v.Validate() +} + +// CallValidate calls `ValidateCustom() error` function if `m` implements it. +func CallValidateCustom(m any) error { + v, ok := m.(CustomValidator) + if !ok { + return nil + } + return v.ValidateCustom() +} diff --git a/examples/validation.pb.go b/examples/validation.pb.go new file mode 100644 index 0000000..3dfb7f9 --- /dev/null +++ b/examples/validation.pb.go @@ -0,0 +1,1341 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: examples/validation.proto + +package examples + +import ( + _ "github.com/cybozu/protobuf/cybozu/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Enums_Enum int32 + +const ( + Enums_E1_UNSPECIFIED Enums_Enum = 0 + Enums_E1_VAL1 Enums_Enum = 1 + Enums_E2_VAL100 Enums_Enum = 100 +) + +// Enum value maps for Enums_Enum. +var ( + Enums_Enum_name = map[int32]string{ + 0: "E1_UNSPECIFIED", + 1: "E1_VAL1", + 100: "E2_VAL100", + } + Enums_Enum_value = map[string]int32{ + "E1_UNSPECIFIED": 0, + "E1_VAL1": 1, + "E2_VAL100": 100, + } +) + +func (x Enums_Enum) Enum() *Enums_Enum { + p := new(Enums_Enum) + *p = x + return p +} + +func (x Enums_Enum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Enums_Enum) Descriptor() protoreflect.EnumDescriptor { + return file_examples_validation_proto_enumTypes[0].Descriptor() +} + +func (Enums_Enum) Type() protoreflect.EnumType { + return &file_examples_validation_proto_enumTypes[0] +} + +func (x Enums_Enum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Enums_Enum.Descriptor instead. +func (Enums_Enum) EnumDescriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{6, 0} +} + +// This message is marked ignored, so no validation method is generated. +type Ignored struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` + Bar int32 `protobuf:"varint,2,opt,name=bar,proto3" json:"bar,omitempty"` // no effect +} + +func (x *Ignored) Reset() { + *x = Ignored{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Ignored) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ignored) ProtoMessage() {} + +func (x *Ignored) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Ignored.ProtoReflect.Descriptor instead. +func (*Ignored) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{0} +} + +func (x *Ignored) GetFoo() string { + if x != nil { + return x.Foo + } + return "" +} + +func (x *Ignored) GetBar() int32 { + if x != nil { + return x.Bar + } + return 0 +} + +// All scalar types can have constraint rules except for bools. +type Scalars struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Float float32 `protobuf:"fixed32,1,opt,name=float,proto3" json:"float,omitempty"` + Double float64 `protobuf:"fixed64,2,opt,name=double,proto3" json:"double,omitempty"` + Int32 int32 `protobuf:"varint,3,opt,name=int32,proto3" json:"int32,omitempty"` + Int64 int64 `protobuf:"varint,4,opt,name=int64,proto3" json:"int64,omitempty"` + Uint32 uint32 `protobuf:"varint,5,opt,name=uint32,proto3" json:"uint32,omitempty"` + Uint64 uint64 `protobuf:"varint,6,opt,name=uint64,proto3" json:"uint64,omitempty"` + Sint32 int32 `protobuf:"zigzag32,7,opt,name=sint32,proto3" json:"sint32,omitempty"` + Sint64 int64 `protobuf:"zigzag64,8,opt,name=sint64,proto3" json:"sint64,omitempty"` + Fixed32 uint32 `protobuf:"fixed32,9,opt,name=fixed32,proto3" json:"fixed32,omitempty"` + Fixed64 uint64 `protobuf:"fixed64,10,opt,name=fixed64,proto3" json:"fixed64,omitempty"` + Sfixed32 int32 `protobuf:"fixed32,11,opt,name=sfixed32,proto3" json:"sfixed32,omitempty"` + Sfixed64 int64 `protobuf:"fixed64,12,opt,name=sfixed64,proto3" json:"sfixed64,omitempty"` + Bool bool `protobuf:"varint,13,opt,name=bool,proto3" json:"bool,omitempty"` // no available rules for bools + String_ string `protobuf:"bytes,14,opt,name=string,proto3" json:"string,omitempty"` + Bytes []byte `protobuf:"bytes,15,opt,name=bytes,proto3" json:"bytes,omitempty"` +} + +func (x *Scalars) Reset() { + *x = Scalars{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Scalars) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scalars) ProtoMessage() {} + +func (x *Scalars) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Scalars.ProtoReflect.Descriptor instead. +func (*Scalars) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{1} +} + +func (x *Scalars) GetFloat() float32 { + if x != nil { + return x.Float + } + return 0 +} + +func (x *Scalars) GetDouble() float64 { + if x != nil { + return x.Double + } + return 0 +} + +func (x *Scalars) GetInt32() int32 { + if x != nil { + return x.Int32 + } + return 0 +} + +func (x *Scalars) GetInt64() int64 { + if x != nil { + return x.Int64 + } + return 0 +} + +func (x *Scalars) GetUint32() uint32 { + if x != nil { + return x.Uint32 + } + return 0 +} + +func (x *Scalars) GetUint64() uint64 { + if x != nil { + return x.Uint64 + } + return 0 +} + +func (x *Scalars) GetSint32() int32 { + if x != nil { + return x.Sint32 + } + return 0 +} + +func (x *Scalars) GetSint64() int64 { + if x != nil { + return x.Sint64 + } + return 0 +} + +func (x *Scalars) GetFixed32() uint32 { + if x != nil { + return x.Fixed32 + } + return 0 +} + +func (x *Scalars) GetFixed64() uint64 { + if x != nil { + return x.Fixed64 + } + return 0 +} + +func (x *Scalars) GetSfixed32() int32 { + if x != nil { + return x.Sfixed32 + } + return 0 +} + +func (x *Scalars) GetSfixed64() int64 { + if x != nil { + return x.Sfixed64 + } + return 0 +} + +func (x *Scalars) GetBool() bool { + if x != nil { + return x.Bool + } + return false +} + +func (x *Scalars) GetString_() string { + if x != nil { + return x.String_ + } + return "" +} + +func (x *Scalars) GetBytes() []byte { + if x != nil { + return x.Bytes + } + return nil +} + +// rules for optional fields are enforced only if the field is set. +type OptionalScalars struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Float *float32 `protobuf:"fixed32,1,opt,name=float,proto3,oneof" json:"float,omitempty"` + Double *float64 `protobuf:"fixed64,2,opt,name=double,proto3,oneof" json:"double,omitempty"` + Int32 *int32 `protobuf:"varint,3,opt,name=int32,proto3,oneof" json:"int32,omitempty"` + Int64 *int64 `protobuf:"varint,4,opt,name=int64,proto3,oneof" json:"int64,omitempty"` + Uint32 *uint32 `protobuf:"varint,5,opt,name=uint32,proto3,oneof" json:"uint32,omitempty"` + Uint64 *uint64 `protobuf:"varint,6,opt,name=uint64,proto3,oneof" json:"uint64,omitempty"` + Sint32 *int32 `protobuf:"zigzag32,7,opt,name=sint32,proto3,oneof" json:"sint32,omitempty"` + Sint64 *int64 `protobuf:"zigzag64,8,opt,name=sint64,proto3,oneof" json:"sint64,omitempty"` + Fixed32 *uint32 `protobuf:"fixed32,9,opt,name=fixed32,proto3,oneof" json:"fixed32,omitempty"` + Fixed64 *uint64 `protobuf:"fixed64,10,opt,name=fixed64,proto3,oneof" json:"fixed64,omitempty"` + Sfixed32 *int32 `protobuf:"fixed32,11,opt,name=sfixed32,proto3,oneof" json:"sfixed32,omitempty"` + Sfixed64 *int64 `protobuf:"fixed64,12,opt,name=sfixed64,proto3,oneof" json:"sfixed64,omitempty"` + Bool *bool `protobuf:"varint,13,opt,name=bool,proto3,oneof" json:"bool,omitempty"` // no available rules for bool + String_ *string `protobuf:"bytes,14,opt,name=string,proto3,oneof" json:"string,omitempty"` + Bytes []byte `protobuf:"bytes,15,opt,name=bytes,proto3,oneof" json:"bytes,omitempty"` +} + +func (x *OptionalScalars) Reset() { + *x = OptionalScalars{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OptionalScalars) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OptionalScalars) ProtoMessage() {} + +func (x *OptionalScalars) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OptionalScalars.ProtoReflect.Descriptor instead. +func (*OptionalScalars) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{2} +} + +func (x *OptionalScalars) GetFloat() float32 { + if x != nil && x.Float != nil { + return *x.Float + } + return 0 +} + +func (x *OptionalScalars) GetDouble() float64 { + if x != nil && x.Double != nil { + return *x.Double + } + return 0 +} + +func (x *OptionalScalars) GetInt32() int32 { + if x != nil && x.Int32 != nil { + return *x.Int32 + } + return 0 +} + +func (x *OptionalScalars) GetInt64() int64 { + if x != nil && x.Int64 != nil { + return *x.Int64 + } + return 0 +} + +func (x *OptionalScalars) GetUint32() uint32 { + if x != nil && x.Uint32 != nil { + return *x.Uint32 + } + return 0 +} + +func (x *OptionalScalars) GetUint64() uint64 { + if x != nil && x.Uint64 != nil { + return *x.Uint64 + } + return 0 +} + +func (x *OptionalScalars) GetSint32() int32 { + if x != nil && x.Sint32 != nil { + return *x.Sint32 + } + return 0 +} + +func (x *OptionalScalars) GetSint64() int64 { + if x != nil && x.Sint64 != nil { + return *x.Sint64 + } + return 0 +} + +func (x *OptionalScalars) GetFixed32() uint32 { + if x != nil && x.Fixed32 != nil { + return *x.Fixed32 + } + return 0 +} + +func (x *OptionalScalars) GetFixed64() uint64 { + if x != nil && x.Fixed64 != nil { + return *x.Fixed64 + } + return 0 +} + +func (x *OptionalScalars) GetSfixed32() int32 { + if x != nil && x.Sfixed32 != nil { + return *x.Sfixed32 + } + return 0 +} + +func (x *OptionalScalars) GetSfixed64() int64 { + if x != nil && x.Sfixed64 != nil { + return *x.Sfixed64 + } + return 0 +} + +func (x *OptionalScalars) GetBool() bool { + if x != nil && x.Bool != nil { + return *x.Bool + } + return false +} + +func (x *OptionalScalars) GetString_() string { + if x != nil && x.String_ != nil { + return *x.String_ + } + return "" +} + +func (x *OptionalScalars) GetBytes() []byte { + if x != nil { + return x.Bytes + } + return nil +} + +type RepeatedScalars struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // a repeated field can specify `repeated` constraints like this + Float []float32 `protobuf:"fixed32,1,rep,packed,name=float,proto3" json:"float,omitempty"` + // or this + Double []float64 `protobuf:"fixed64,2,rep,packed,name=double,proto3" json:"double,omitempty"` + // or this. + String_ []string `protobuf:"bytes,3,rep,name=string,proto3" json:"string,omitempty"` +} + +func (x *RepeatedScalars) Reset() { + *x = RepeatedScalars{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RepeatedScalars) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RepeatedScalars) ProtoMessage() {} + +func (x *RepeatedScalars) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RepeatedScalars.ProtoReflect.Descriptor instead. +func (*RepeatedScalars) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{3} +} + +func (x *RepeatedScalars) GetFloat() []float32 { + if x != nil { + return x.Float + } + return nil +} + +func (x *RepeatedScalars) GetDouble() []float64 { + if x != nil { + return x.Double + } + return nil +} + +func (x *RepeatedScalars) GetString_() []string { + if x != nil { + return x.String_ + } + return nil +} + +// Strings have the richest set of constraint rules. +type Strings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // NFC normalization is applied if no options are given. + S1 string `protobuf:"bytes,1,opt,name=s1,proto3" json:"s1,omitempty"` + // normalize into the NFD form. + S2 string `protobuf:"bytes,2,opt,name=s2,proto3" json:"s2,omitempty"` + // enforce the minimum length of the string if the string is NOT empty. + S3 string `protobuf:"bytes,3,opt,name=s3,proto3" json:"s3,omitempty"` + // normalize and validate the string with a PRECIS profile. + S4 string `protobuf:"bytes,4,opt,name=s4,proto3" json:"s4,omitempty"` + // enforce that the string matches a regular expresson. The regular expression syntax is RE2. + // See https://github.com/google/re2/wiki/Syntax + S5 string `protobuf:"bytes,5,opt,name=s5,proto3" json:"s5,omitempty"` + // enforce that the string is a valid email address as defined in RFC 5322. + S6 string `protobuf:"bytes,6,opt,name=s6,proto3" json:"s6,omitempty"` + // enforce that the string is a valid URI as defined in RFC 3986. + // The string will also be canonicalized. + S7 string `protobuf:"bytes,7,opt,name=s7,proto3" json:"s7,omitempty"` + // enforce that the string is a valid telephone number as defined by E.164. + // An example is "+81-80-0000-0000". + S8 string `protobuf:"bytes,8,opt,name=s8,proto3" json:"s8,omitempty"` +} + +func (x *Strings) Reset() { + *x = Strings{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Strings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Strings) ProtoMessage() {} + +func (x *Strings) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Strings.ProtoReflect.Descriptor instead. +func (*Strings) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{4} +} + +func (x *Strings) GetS1() string { + if x != nil { + return x.S1 + } + return "" +} + +func (x *Strings) GetS2() string { + if x != nil { + return x.S2 + } + return "" +} + +func (x *Strings) GetS3() string { + if x != nil { + return x.S3 + } + return "" +} + +func (x *Strings) GetS4() string { + if x != nil { + return x.S4 + } + return "" +} + +func (x *Strings) GetS5() string { + if x != nil { + return x.S5 + } + return "" +} + +func (x *Strings) GetS6() string { + if x != nil { + return x.S6 + } + return "" +} + +func (x *Strings) GetS7() string { + if x != nil { + return x.S7 + } + return "" +} + +func (x *Strings) GetS8() string { + if x != nil { + return x.S8 + } + return "" +} + +// In addition to the validation code generated from the protobuf options, +// this message implements a custom validation. See `example_custom.go` +// in the same directory. +type Maps struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // you can put a constraint for map and a constraint for the value type as follows. + Map1 map[string]int32 `protobuf:"bytes,1,rep,name=map1,proto3" json:"map1,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + // or either one of them. The following enforces that the timestamp is set. + Map2 map[string]*timestamppb.Timestamp `protobuf:"bytes,2,rep,name=map2,proto3" json:"map2,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // string values are normalized into the NFC form even if there's no rules specified. + Map3 map[uint32]string `protobuf:"bytes,3,rep,name=map3,proto3" json:"map3,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *Maps) Reset() { + *x = Maps{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Maps) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Maps) ProtoMessage() {} + +func (x *Maps) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Maps.ProtoReflect.Descriptor instead. +func (*Maps) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{5} +} + +func (x *Maps) GetMap1() map[string]int32 { + if x != nil { + return x.Map1 + } + return nil +} + +func (x *Maps) GetMap2() map[string]*timestamppb.Timestamp { + if x != nil { + return x.Map2 + } + return nil +} + +func (x *Maps) GetMap3() map[uint32]string { + if x != nil { + return x.Map3 + } + return nil +} + +type Enums struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // enforces that `e1` is not the zero value. + E1 Enums_Enum `protobuf:"varint,1,opt,name=e1,proto3,enum=examples.Enums_Enum" json:"e1,omitempty"` + // enforces that `e2` is one of the defined enum value. + E2 Enums_Enum `protobuf:"varint,2,opt,name=e2,proto3,enum=examples.Enums_Enum" json:"e2,omitempty"` + // enforces that `e3` is one of the defined enum value other than zero. + E3 Enums_Enum `protobuf:"varint,3,opt,name=e3,proto3,enum=examples.Enums_Enum" json:"e3,omitempty"` +} + +func (x *Enums) Reset() { + *x = Enums{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Enums) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Enums) ProtoMessage() {} + +func (x *Enums) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Enums.ProtoReflect.Descriptor instead. +func (*Enums) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{6} +} + +func (x *Enums) GetE1() Enums_Enum { + if x != nil { + return x.E1 + } + return Enums_E1_UNSPECIFIED +} + +func (x *Enums) GetE2() Enums_Enum { + if x != nil { + return x.E2 + } + return Enums_E1_UNSPECIFIED +} + +func (x *Enums) GetE3() Enums_Enum { + if x != nil { + return x.E3 + } + return Enums_E1_UNSPECIFIED +} + +type Oneofs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to O1: + // + // *Oneofs_Int32 + // *Oneofs_String_ + O1 isOneofs_O1 `protobuf_oneof:"o1"` + // Types that are assignable to O2: + // + // *Oneofs_Ts + // *Oneofs_Bool + O2 isOneofs_O2 `protobuf_oneof:"o2"` +} + +func (x *Oneofs) Reset() { + *x = Oneofs{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Oneofs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Oneofs) ProtoMessage() {} + +func (x *Oneofs) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Oneofs.ProtoReflect.Descriptor instead. +func (*Oneofs) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{7} +} + +func (m *Oneofs) GetO1() isOneofs_O1 { + if m != nil { + return m.O1 + } + return nil +} + +func (x *Oneofs) GetInt32() int32 { + if x, ok := x.GetO1().(*Oneofs_Int32); ok { + return x.Int32 + } + return 0 +} + +func (x *Oneofs) GetString_() string { + if x, ok := x.GetO1().(*Oneofs_String_); ok { + return x.String_ + } + return "" +} + +func (m *Oneofs) GetO2() isOneofs_O2 { + if m != nil { + return m.O2 + } + return nil +} + +func (x *Oneofs) GetTs() *timestamppb.Timestamp { + if x, ok := x.GetO2().(*Oneofs_Ts); ok { + return x.Ts + } + return nil +} + +func (x *Oneofs) GetBool() bool { + if x, ok := x.GetO2().(*Oneofs_Bool); ok { + return x.Bool + } + return false +} + +type isOneofs_O1 interface { + isOneofs_O1() +} + +type Oneofs_Int32 struct { + Int32 int32 `protobuf:"varint,1,opt,name=int32,proto3,oneof"` +} + +type Oneofs_String_ struct { + String_ string `protobuf:"bytes,2,opt,name=string,proto3,oneof"` +} + +func (*Oneofs_Int32) isOneofs_O1() {} + +func (*Oneofs_String_) isOneofs_O1() {} + +type isOneofs_O2 interface { + isOneofs_O2() +} + +type Oneofs_Ts struct { + Ts *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=ts,proto3,oneof"` +} + +type Oneofs_Bool struct { + Bool bool `protobuf:"varint,4,opt,name=bool,proto3,oneof"` +} + +func (*Oneofs_Ts) isOneofs_O2() {} + +func (*Oneofs_Bool) isOneofs_O2() {} + +type Composed struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // enforces that `ignored` is set. + Ignored *Ignored `protobuf:"bytes,1,opt,name=ignored,proto3" json:"ignored,omitempty"` + Scalars *Scalars `protobuf:"bytes,2,opt,name=scalars,proto3" json:"scalars,omitempty"` + Maps []*Maps `protobuf:"bytes,3,rep,name=maps,proto3" json:"maps,omitempty"` + // enforces that all messages in `enums` are set. + Enums []*Enums `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` +} + +func (x *Composed) Reset() { + *x = Composed{} + if protoimpl.UnsafeEnabled { + mi := &file_examples_validation_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Composed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Composed) ProtoMessage() {} + +func (x *Composed) ProtoReflect() protoreflect.Message { + mi := &file_examples_validation_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Composed.ProtoReflect.Descriptor instead. +func (*Composed) Descriptor() ([]byte, []int) { + return file_examples_validation_proto_rawDescGZIP(), []int{8} +} + +func (x *Composed) GetIgnored() *Ignored { + if x != nil { + return x.Ignored + } + return nil +} + +func (x *Composed) GetScalars() *Scalars { + if x != nil { + return x.Scalars + } + return nil +} + +func (x *Composed) GetMaps() []*Maps { + if x != nil { + return x.Maps + } + return nil +} + +func (x *Composed) GetEnums() []*Enums { + if x != nil { + return x.Enums + } + return nil +} + +var File_examples_validation_proto protoreflect.FileDescriptor + +var file_examples_validation_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x65, 0x78, 0x61, + 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x1a, 0x1d, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2f, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x07, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, + 0x12, 0x10, 0x0a, 0x03, 0x66, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x66, + 0x6f, 0x6f, 0x12, 0x1b, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, + 0x09, 0xc2, 0xe6, 0xc3, 0x01, 0x04, 0x1a, 0x02, 0x08, 0x64, 0x52, 0x03, 0x62, 0x61, 0x72, 0x3a, + 0x05, 0xc0, 0xe6, 0xc3, 0x01, 0x01, 0x22, 0xb0, 0x04, 0x0a, 0x07, 0x53, 0x63, 0x61, 0x6c, 0x61, + 0x72, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x02, 0x42, 0x0c, 0xc2, 0xe6, 0xc3, 0x01, 0x07, 0x0a, 0x05, 0x0d, 0xcd, 0xcc, 0x4c, 0x40, 0x52, + 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x28, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x42, 0x10, 0xc2, 0xe6, 0xc3, 0x01, 0x0b, 0x12, 0x09, 0x19, + 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99, 0x09, 0x40, 0x52, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x12, 0x28, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, + 0x12, 0xc2, 0xe6, 0xc3, 0x01, 0x0d, 0x1a, 0x0b, 0x10, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x1f, 0x0a, 0x05, 0x69, 0x6e, + 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x09, 0xc2, 0xe6, 0xc3, 0x01, 0x04, + 0x22, 0x02, 0x20, 0x01, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x23, 0x0a, 0x06, 0x75, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, + 0x01, 0x06, 0x2a, 0x04, 0x08, 0x05, 0x18, 0x01, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, + 0x12, 0x23, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, + 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x32, 0x04, 0x10, 0x05, 0x20, 0x01, 0x52, 0x06, 0x75, + 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x23, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x11, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x3a, 0x04, 0x08, 0x05, + 0x18, 0x01, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x23, 0x0a, 0x06, 0x73, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x12, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, + 0x06, 0x42, 0x04, 0x10, 0x05, 0x20, 0x01, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, + 0x25, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x07, + 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x4a, 0x04, 0x08, 0x05, 0x18, 0x01, 0x52, 0x07, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x25, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, + 0x34, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x06, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x52, 0x04, + 0x08, 0x05, 0x18, 0x01, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, 0x27, 0x0a, + 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0f, 0x42, + 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x5a, 0x04, 0x08, 0x05, 0x18, 0x01, 0x52, 0x08, 0x73, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x12, 0x27, 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, + 0x36, 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x10, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x62, + 0x04, 0x08, 0x05, 0x18, 0x01, 0x52, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x12, + 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x62, + 0x6f, 0x6f, 0x6c, 0x12, 0x23, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x03, + 0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1f, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x09, 0xc2, 0xe6, 0xc3, 0x01, 0x04, 0x72, 0x02, + 0x20, 0x0a, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x22, 0xa8, 0x06, 0x0a, 0x0f, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x12, 0x27, 0x0a, + 0x05, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0c, 0xc2, 0xe6, + 0xc3, 0x01, 0x07, 0x0a, 0x05, 0x0d, 0xcd, 0xcc, 0x4c, 0x40, 0x48, 0x00, 0x52, 0x05, 0x66, 0x6c, + 0x6f, 0x61, 0x74, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x42, 0x10, 0xc2, 0xe6, 0xc3, 0x01, 0x0b, 0x12, 0x09, 0x19, + 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99, 0x09, 0x40, 0x48, 0x01, 0x52, 0x06, 0x64, 0x6f, 0x75, 0x62, + 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x42, 0x12, 0xc2, 0xe6, 0xc3, 0x01, 0x0d, 0x1a, 0x0b, 0x10, 0xfd, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x48, 0x02, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x33, + 0x32, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x42, 0x09, 0xc2, 0xe6, 0xc3, 0x01, 0x04, 0x22, 0x02, 0x20, 0x01, 0x48, 0x03, + 0x52, 0x05, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x06, 0x75, 0x69, + 0x6e, 0x74, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, + 0x06, 0x2a, 0x04, 0x08, 0x05, 0x18, 0x01, 0x48, 0x04, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x33, + 0x32, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x32, 0x04, 0x10, 0x05, 0x20, + 0x01, 0x48, 0x05, 0x52, 0x06, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x88, 0x01, 0x01, 0x12, 0x28, + 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x11, 0x42, 0x0b, + 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x3a, 0x04, 0x08, 0x05, 0x18, 0x01, 0x48, 0x06, 0x52, 0x06, 0x73, + 0x69, 0x6e, 0x74, 0x33, 0x32, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x18, 0x08, 0x20, 0x01, 0x28, 0x12, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x42, + 0x04, 0x10, 0x05, 0x20, 0x01, 0x48, 0x07, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x88, + 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x07, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x4a, 0x04, 0x08, 0x05, 0x18, 0x01, + 0x48, 0x08, 0x52, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x88, 0x01, 0x01, 0x12, 0x2a, + 0x0a, 0x07, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x06, 0x42, + 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x52, 0x04, 0x08, 0x05, 0x18, 0x01, 0x48, 0x09, 0x52, 0x07, + 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0f, 0x42, 0x0b, 0xc2, 0xe6, + 0xc3, 0x01, 0x06, 0x5a, 0x04, 0x08, 0x05, 0x18, 0x01, 0x48, 0x0a, 0x52, 0x08, 0x73, 0x66, 0x69, + 0x78, 0x65, 0x64, 0x33, 0x32, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x66, 0x69, 0x78, + 0x65, 0x64, 0x36, 0x34, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x10, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, + 0x06, 0x62, 0x04, 0x08, 0x05, 0x18, 0x01, 0x48, 0x0b, 0x52, 0x08, 0x73, 0x66, 0x69, 0x78, 0x65, + 0x64, 0x36, 0x34, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x08, 0x48, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x88, 0x01, 0x01, 0x12, + 0x28, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x72, 0x04, 0x10, 0x01, 0x18, 0x03, 0x48, 0x0d, 0x52, 0x06, + 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x05, 0x62, 0x79, 0x74, + 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x09, 0xc2, 0xe6, 0xc3, 0x01, 0x04, 0x72, + 0x02, 0x20, 0x0a, 0x48, 0x0e, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x64, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x75, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x73, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, + 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x66, 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x42, 0x0b, 0x0a, 0x09, + 0x5f, 0x73, 0x66, 0x69, 0x78, 0x65, 0x64, 0x33, 0x32, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x73, 0x66, + 0x69, 0x78, 0x65, 0x64, 0x36, 0x34, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x61, + 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x02, 0x42, 0x11, 0xc2, 0xe6, 0xc3, 0x01, 0x0c, 0x0a, 0x05, + 0x0d, 0xcd, 0xcc, 0x4c, 0x40, 0xc2, 0x3e, 0x02, 0x08, 0x01, 0x52, 0x05, 0x66, 0x6c, 0x6f, 0x61, + 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x01, 0x42, 0x15, 0xc2, 0xe6, 0xc3, 0x01, 0x10, 0x12, 0x09, 0x19, 0x9a, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x09, 0x40, 0xc2, 0x3e, 0x02, 0x10, 0x03, 0x52, 0x06, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, + 0x12, 0x22, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0xc2, 0x3e, 0x02, 0x08, 0x02, 0x52, 0x06, 0x73, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x22, 0xdf, 0x01, 0x0a, 0x07, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, + 0x12, 0x0e, 0x0a, 0x02, 0x73, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x73, 0x31, + 0x12, 0x19, 0x0a, 0x02, 0x73, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xc2, 0xe6, + 0xc3, 0x01, 0x04, 0x72, 0x02, 0x08, 0x01, 0x52, 0x02, 0x73, 0x32, 0x12, 0x1b, 0x0a, 0x02, 0x73, + 0x33, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xc2, 0xe6, 0xc3, 0x01, 0x06, 0x72, 0x04, + 0x10, 0x01, 0x18, 0x0a, 0x52, 0x02, 0x73, 0x33, 0x12, 0x19, 0x0a, 0x02, 0x73, 0x34, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x09, 0xc2, 0xe6, 0xc3, 0x01, 0x04, 0x72, 0x02, 0x08, 0x64, 0x52, + 0x02, 0x73, 0x34, 0x12, 0x1d, 0x0a, 0x02, 0x73, 0x35, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0d, 0xc2, 0xe6, 0xc3, 0x01, 0x08, 0x72, 0x06, 0x2a, 0x04, 0x5e, 0x61, 0x62, 0x63, 0x52, 0x02, + 0x73, 0x35, 0x12, 0x1a, 0x0a, 0x02, 0x73, 0x36, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, + 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0x72, 0x03, 0xa0, 0x06, 0x01, 0x52, 0x02, 0x73, 0x36, 0x12, 0x1a, + 0x0a, 0x02, 0x73, 0x37, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, + 0x05, 0x72, 0x03, 0xa8, 0x06, 0x01, 0x52, 0x02, 0x73, 0x37, 0x12, 0x1a, 0x0a, 0x02, 0x73, 0x38, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0x72, 0x03, 0xb0, + 0x06, 0x01, 0x52, 0x02, 0x73, 0x38, 0x22, 0xf3, 0x02, 0x0a, 0x04, 0x4d, 0x61, 0x70, 0x73, 0x12, + 0x3c, 0x0a, 0x04, 0x6d, 0x61, 0x70, 0x31, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x61, + 0x70, 0x31, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0e, 0xc2, 0xe6, 0xc3, 0x01, 0x09, 0x1a, 0x02, + 0x18, 0x03, 0xca, 0x3e, 0x02, 0x08, 0x01, 0x52, 0x04, 0x6d, 0x61, 0x70, 0x31, 0x12, 0x38, 0x0a, + 0x04, 0x6d, 0x61, 0x70, 0x32, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78, + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x32, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0x8a, 0x01, 0x02, 0x08, + 0x01, 0x52, 0x04, 0x6d, 0x61, 0x70, 0x32, 0x12, 0x2c, 0x0a, 0x04, 0x6d, 0x61, 0x70, 0x33, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, + 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x33, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x04, 0x6d, 0x61, 0x70, 0x33, 0x1a, 0x37, 0x0a, 0x09, 0x4d, 0x61, 0x70, 0x31, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x53, + 0x0a, 0x09, 0x4d, 0x61, 0x70, 0x32, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x4d, 0x61, 0x70, 0x33, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd7, 0x01, 0x0a, + 0x05, 0x45, 0x6e, 0x75, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x02, 0x65, 0x31, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x45, 0x6e, + 0x75, 0x6d, 0x73, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0x82, + 0x01, 0x02, 0x08, 0x01, 0x52, 0x02, 0x65, 0x31, 0x12, 0x30, 0x0a, 0x02, 0x65, 0x32, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x73, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, + 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x02, 0x65, 0x32, 0x12, 0x32, 0x0a, 0x02, 0x65, 0x33, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x73, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x73, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0c, 0xc2, 0xe6, + 0xc3, 0x01, 0x07, 0x82, 0x01, 0x04, 0x08, 0x01, 0x10, 0x01, 0x52, 0x02, 0x65, 0x33, 0x22, 0x36, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x31, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x31, + 0x5f, 0x56, 0x41, 0x4c, 0x31, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x45, 0x32, 0x5f, 0x56, 0x41, + 0x4c, 0x31, 0x30, 0x30, 0x10, 0x64, 0x22, 0xa5, 0x01, 0x0a, 0x06, 0x4f, 0x6e, 0x65, 0x6f, 0x66, + 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x42, 0x12, 0xc2, 0xe6, 0xc3, 0x01, 0x0d, 0x1a, 0x0b, 0x10, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x12, 0x18, 0x0a, + 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x02, 0x74, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, + 0x01, 0x52, 0x02, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x42, 0x04, 0x0a, 0x02, 0x6f, + 0x31, 0x42, 0x0b, 0x0a, 0x02, 0x6f, 0x32, 0x12, 0x05, 0xc0, 0xe6, 0xc3, 0x01, 0x01, 0x22, 0xc7, + 0x01, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x07, 0x69, + 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x65, + 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x49, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x42, + 0x0a, 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0x8a, 0x01, 0x02, 0x08, 0x01, 0x52, 0x07, 0x69, 0x67, 0x6e, + 0x6f, 0x72, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x07, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, + 0x2e, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x52, 0x07, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, + 0x73, 0x12, 0x22, 0x0a, 0x04, 0x6d, 0x61, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0e, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, 0x4d, 0x61, 0x70, 0x73, 0x52, + 0x04, 0x6d, 0x61, 0x70, 0x73, 0x12, 0x31, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x73, 0x42, 0x0a, 0xc2, 0xe6, 0xc3, 0x01, 0x05, 0x8a, 0x01, 0x02, 0x08, + 0x01, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x42, 0x22, 0x5a, 0x20, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x79, 0x62, 0x6f, 0x7a, 0x75, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_examples_validation_proto_rawDescOnce sync.Once + file_examples_validation_proto_rawDescData = file_examples_validation_proto_rawDesc +) + +func file_examples_validation_proto_rawDescGZIP() []byte { + file_examples_validation_proto_rawDescOnce.Do(func() { + file_examples_validation_proto_rawDescData = protoimpl.X.CompressGZIP(file_examples_validation_proto_rawDescData) + }) + return file_examples_validation_proto_rawDescData +} + +var file_examples_validation_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_examples_validation_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_examples_validation_proto_goTypes = []interface{}{ + (Enums_Enum)(0), // 0: examples.Enums.Enum + (*Ignored)(nil), // 1: examples.Ignored + (*Scalars)(nil), // 2: examples.Scalars + (*OptionalScalars)(nil), // 3: examples.OptionalScalars + (*RepeatedScalars)(nil), // 4: examples.RepeatedScalars + (*Strings)(nil), // 5: examples.Strings + (*Maps)(nil), // 6: examples.Maps + (*Enums)(nil), // 7: examples.Enums + (*Oneofs)(nil), // 8: examples.Oneofs + (*Composed)(nil), // 9: examples.Composed + nil, // 10: examples.Maps.Map1Entry + nil, // 11: examples.Maps.Map2Entry + nil, // 12: examples.Maps.Map3Entry + (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp +} +var file_examples_validation_proto_depIdxs = []int32{ + 10, // 0: examples.Maps.map1:type_name -> examples.Maps.Map1Entry + 11, // 1: examples.Maps.map2:type_name -> examples.Maps.Map2Entry + 12, // 2: examples.Maps.map3:type_name -> examples.Maps.Map3Entry + 0, // 3: examples.Enums.e1:type_name -> examples.Enums.Enum + 0, // 4: examples.Enums.e2:type_name -> examples.Enums.Enum + 0, // 5: examples.Enums.e3:type_name -> examples.Enums.Enum + 13, // 6: examples.Oneofs.ts:type_name -> google.protobuf.Timestamp + 1, // 7: examples.Composed.ignored:type_name -> examples.Ignored + 2, // 8: examples.Composed.scalars:type_name -> examples.Scalars + 6, // 9: examples.Composed.maps:type_name -> examples.Maps + 7, // 10: examples.Composed.enums:type_name -> examples.Enums + 13, // 11: examples.Maps.Map2Entry.value:type_name -> google.protobuf.Timestamp + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_examples_validation_proto_init() } +func file_examples_validation_proto_init() { + if File_examples_validation_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_examples_validation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Ignored); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Scalars); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OptionalScalars); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RepeatedScalars); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Strings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Maps); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Enums); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Oneofs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_examples_validation_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Composed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_examples_validation_proto_msgTypes[2].OneofWrappers = []interface{}{} + file_examples_validation_proto_msgTypes[7].OneofWrappers = []interface{}{ + (*Oneofs_Int32)(nil), + (*Oneofs_String_)(nil), + (*Oneofs_Ts)(nil), + (*Oneofs_Bool)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_examples_validation_proto_rawDesc, + NumEnums: 1, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_examples_validation_proto_goTypes, + DependencyIndexes: file_examples_validation_proto_depIdxs, + EnumInfos: file_examples_validation_proto_enumTypes, + MessageInfos: file_examples_validation_proto_msgTypes, + }.Build() + File_examples_validation_proto = out.File + file_examples_validation_proto_rawDesc = nil + file_examples_validation_proto_goTypes = nil + file_examples_validation_proto_depIdxs = nil +} diff --git a/examples/validation.proto b/examples/validation.proto new file mode 100644 index 0000000..7db5fa3 --- /dev/null +++ b/examples/validation.proto @@ -0,0 +1,208 @@ +syntax = "proto3"; + +package examples; + +import "cybozu/validate/options.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/cybozu/proto/examples"; + +// This message is marked ignored, so no validation method is generated. +message Ignored { + option (cybozu.validate.ignored) = true; + + string foo = 1; + int32 bar = 2 [(cybozu.validate.rules).int32 = {lt: 100}]; // no effect +} + +// All scalar types can have constraint rules except for bools. +message Scalars { + float float = 1 [(cybozu.validate.rules).float = {lt: 3.2}]; + double double = 2 [(cybozu.validate.rules).double = {gt: 3.2}]; + int32 int32 = 3 [(cybozu.validate.rules).int32 = {lte: -3}]; + int64 int64 = 4 [(cybozu.validate.rules).int64 = {gte: 1}]; + uint32 uint32 = 5 [(cybozu.validate.rules).uint32 = { + gt: 1 + lt: 5 + }]; + uint64 uint64 = 6 [(cybozu.validate.rules).uint64 = { + gte: 1 + lte: 5 + }]; + sint32 sint32 = 7 [(cybozu.validate.rules).sint32 = { + gt: 1 + lt: 5 + }]; + sint64 sint64 = 8 [(cybozu.validate.rules).sint64 = { + gte: 1 + lte: 5 + }]; + fixed32 fixed32 = 9 [(cybozu.validate.rules).fixed32 = { + gt: 1 + lt: 5 + }]; + fixed64 fixed64 = 10 [(cybozu.validate.rules).fixed64 = { + gt: 1 + lt: 5 + }]; + sfixed32 sfixed32 = 11 [(cybozu.validate.rules).sfixed32 = { + gt: 1 + lt: 5 + }]; + sfixed64 sfixed64 = 12 [(cybozu.validate.rules).sfixed64 = { + gt: 1 + lt: 5 + }]; + bool bool = 13; // no available rules for bools + string string = 14 [(cybozu.validate.rules).string = { + min_length: 3 + ignore_empty: true + }]; + bytes bytes = 15 [(cybozu.validate.rules).string = {max_length: 10}]; +} + +// rules for optional fields are enforced only if the field is set. +message OptionalScalars { + optional float float = 1 [(cybozu.validate.rules).float = {lt: 3.2}]; + optional double double = 2 [(cybozu.validate.rules).double = {gt: 3.2}]; + optional int32 int32 = 3 [(cybozu.validate.rules).int32 = {lte: -3}]; + optional int64 int64 = 4 [(cybozu.validate.rules).int64 = {gte: 1}]; + optional uint32 uint32 = 5 [(cybozu.validate.rules).uint32 = { + gt: 1 + lt: 5 + }]; + optional uint64 uint64 = 6 [(cybozu.validate.rules).uint64 = { + gte: 1 + lte: 5 + }]; + optional sint32 sint32 = 7 [(cybozu.validate.rules).sint32 = { + gt: 1 + lt: 5 + }]; + optional sint64 sint64 = 8 [(cybozu.validate.rules).sint64 = { + gte: 1 + lte: 5 + }]; + optional fixed32 fixed32 = 9 [(cybozu.validate.rules).fixed32 = { + gt: 1 + lt: 5 + }]; + optional fixed64 fixed64 = 10 [(cybozu.validate.rules).fixed64 = { + gt: 1 + lt: 5 + }]; + optional sfixed32 sfixed32 = 11 [(cybozu.validate.rules).sfixed32 = { + gt: 1 + lt: 5 + }]; + optional sfixed64 sfixed64 = 12 [(cybozu.validate.rules).sfixed64 = { + gt: 1 + lt: 5 + }]; + optional bool bool = 13; // no available rules for bool + optional string string = 14 [(cybozu.validate.rules).string = { + min_length: 3 + ignore_empty: true + }]; + optional bytes bytes = 15 [(cybozu.validate.rules).string = {max_length: 10}]; +} + +message RepeatedScalars { + // a repeated field can specify `repeated` constraints like this + repeated float float = 1 [ + (cybozu.validate.rules).float = {lt: 3.2}, + (cybozu.validate.rules).repeated = {min_items: 1} + ]; + // or this + repeated double double = 2 [(cybozu.validate.rules) = { + double: {gt: 3.2} + repeated: {max_items: 3} + }]; + // or this. + repeated string string = 3 [(cybozu.validate.rules).repeated = {min_items: 2}]; +} + +// Strings have the richest set of constraint rules. +message Strings { + // NFC normalization is applied if no options are given. + string s1 = 1; + // normalize into the NFD form. + string s2 = 2 [(cybozu.validate.rules).string = {norm: NFD}]; + // enforce the minimum length of the string if the string is NOT empty. + string s3 = 3 [(cybozu.validate.rules).string = { + min_length: 10 + ignore_empty: true + }]; + // normalize and validate the string with a PRECIS profile. + string s4 = 4 [(cybozu.validate.rules).string = {norm: PRECIS_USERNAME_CASE_MAPPED}]; + // enforce that the string matches a regular expresson. The regular expression syntax is RE2. + // See https://github.com/google/re2/wiki/Syntax + string s5 = 5 [(cybozu.validate.rules).string = {regex: '^abc'}]; + // enforce that the string is a valid email address as defined in RFC 5322. + string s6 = 6 [(cybozu.validate.rules).string = {email: true}]; + // enforce that the string is a valid URI as defined in RFC 3986. + // The string will also be canonicalized. + string s7 = 7 [(cybozu.validate.rules).string = {uri: true}]; + // enforce that the string is a valid telephone number as defined by E.164. + // An example is "+81-80-0000-0000". + string s8 = 8 [(cybozu.validate.rules).string = {e164: true}]; +} + +// In addition to the validation code generated from the protobuf options, +// this message implements a custom validation. See `example_custom.go` +// in the same directory. +message Maps { + // you can put a constraint for map and a constraint for the value type as follows. + map map1 = 1 [(cybozu.validate.rules) = { + map: {min_items: 1} + int32: {gt: 3} + }]; + + // or either one of them. The following enforces that the timestamp is set. + map map2 = 2 [(cybozu.validate.rules).message.required = true]; + + // string values are normalized into the NFC form even if there's no rules specified. + map map3 = 3; +} + +message Enums { + enum Enum { + E1_UNSPECIFIED = 0; + E1_VAL1 = 1; + E2_VAL100 = 100; + } + + // enforces that `e1` is not the zero value. + Enum e1 = 1 [(cybozu.validate.rules).enum.required = true]; + // enforces that `e2` is one of the defined enum value. + Enum e2 = 2 [(cybozu.validate.rules).enum.defined_only = true]; + // enforces that `e3` is one of the defined enum value other than zero. + Enum e3 = 3 [(cybozu.validate.rules).enum = { + required: true + defined_only: true + }]; +} + +message Oneofs { + oneof o1 { + int32 int32 = 1 [(cybozu.validate.rules).int32 = {lte: -3}]; + string string = 2; + } + + oneof o2 { + // enforces that one of the fields, `ts` or `bool`, is specified. + option (cybozu.validate.required) = true; + + google.protobuf.Timestamp ts = 3; + bool bool = 4; + } +} + +message Composed { + // enforces that `ignored` is set. + Ignored ignored = 1 [(cybozu.validate.rules).message.required = true]; + Scalars scalars = 2; + repeated Maps maps = 3; + // enforces that all messages in `enums` are set. + repeated Enums enums = 4 [(cybozu.validate.rules).message.required = true]; +} diff --git a/examples/validation_custom.go b/examples/validation_custom.go new file mode 100644 index 0000000..c0b894a --- /dev/null +++ b/examples/validation_custom.go @@ -0,0 +1,23 @@ +package examples + +import ( + "fmt" + + "github.com/cybozu/protobuf/cybozu/validate" +) + +// ValidateCustom is a hand-written additional validation for Maps. +// You can do any validation/normalization here. +// +// This example checks that the total number of items in all map +// fields is not over 10. +func (x *Maps) ValidateCustom() error { + total := len(x.Map1) + len(x.Map2) + len(x.Map3) + if total > 10 { + return fmt.Errorf("too many items: %d", total) + } + return nil +} + +// A Go idiom to statically check if a type implements an interface, here `validate.CustomValidator`. +var _ validate.CustomValidator = &Maps{} diff --git a/examples/validation_cybozu_validate2.pb.go b/examples/validation_cybozu_validate2.pb.go new file mode 100644 index 0000000..a7017dc --- /dev/null +++ b/examples/validation_cybozu_validate2.pb.go @@ -0,0 +1,394 @@ +package examples + +import ( + "errors" + "fmt" + "net/mail" + "net/url" + "regexp" + "strings" + "unicode/utf8" + + "github.com/cybozu/protobuf/cybozu/validate" + "golang.org/x/text/secure/precis" + "golang.org/x/text/unicode/norm" + "google.golang.org/protobuf/types/known/timestamppb" +) + +func (x *Scalars) Validate() error { + var el []error + if v := x.Float; true { + if v >= 3.2 { + el = append(el, fmt.Errorf("invalid value for Scalars.float: %v", v)) + } + } + if v := x.Uint32; true { + if v <= 1 || v >= 5 { + el = append(el, fmt.Errorf("invalid value for Scalars.uint32: %v", v)) + } + } + x.String_ = norm.NFC.String(x.String_) + if v := x.String_; true { + if v != "" { + if len(v) < 3 { + el = append(el, fmt.Errorf("too short string for Scalars.string")) + } + } + } + if v := x.Bytes; true { + if len(v) > 10 { + el = append(el, fmt.Errorf("too long bytes for Scalars.bytes")) + } + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +func (x *OptionalScalars) Validate() error { + var el []error + if x.Float != nil { + v := *x.Float + if v >= 3.2 { + el = append(el, fmt.Errorf("invalid value for OptionalScalars.float: %v", v)) + } + } + if x.Uint32 != nil { + v := *x.Uint32 + if v <= 1 || v >= 5 { + el = append(el, fmt.Errorf("invalid value for OptionalScalars.uint32: %v", v)) + } + } + if x.String_ != nil { + v := *x.String_ + *x.String_ = norm.NFC.String(v) + if v != "" { + if len(v) < 3 { + el = append(el, fmt.Errorf("too short string for OptionalScalars.string")) + } + } + } + if len(x.Bytes) > 10 { + el = append(el, fmt.Errorf("too long bytes for OptionalScalars.bytes")) + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +func (x *RepeatedScalars) Validate() error { + var el []error + if len(x.Float) < 1 { + el = append(el, fmt.Errorf("too few items in RepeatedScalars.float")) + } + for _, v := range x.Float { + if v >= 3.2 { + el = append(el, fmt.Errorf("invalid value for RepeatedScalars.float: %v", v)) + } + } + if len(x.Double) > 3 { + el = append(el, fmt.Errorf("too many items in RepeatedScalars.double")) + } + for _, v := range x.Double { + if v <= 3.2 { + el = append(el, fmt.Errorf("invalid value for RepeatedScalars.double: %v", v)) + } + } + if len(x.String_) < 2 { + el = append(el, fmt.Errorf("too few items in RepeatedScalars.string")) + } + for i, v := range x.String_ { + x.String_[i] = norm.NFC.String(v) + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +var regex_Strings_S5 = regexp.MustCompile(`^abc`) + +func (x *Strings) Validate() error { + var el []error + x.S1 = norm.NFC.String(x.S1) + x.S2 = norm.NFD.String(x.S2) + x.S3 = norm.NFC.String(x.S3) + if v := x.S3; true { + if v != "" { + if vlen := utf8.RuneCountInString(v); vlen < 10 { + el = append(el, fmt.Errorf("invalid value for Strings.s3: %v", v)) + } + } + } + if v, err := precis.UsernameCaseMapped.String(x.S4); err != nil { + el = append(el, fmt.Errorf("invalid value for Strings.s4: %v, %w", v, err)) + } else { + x.S4 = v + } + x.S5 = norm.NFC.String(x.S5) + if v := x.S5; true { + if !regex_Strings_S5.MatchString(v) { + el = append(el, fmt.Errorf("invalid value for Strings.s5: %v", v)) + } + } + x.S6 = norm.NFC.String(x.S6) + if v := x.S6; true { + if a, err := mail.ParseAddress(v); err != nil { + el = append(el, fmt.Errorf("invalid value for Strings.s6: %v, %w", v, err)) + } else if a.Name != "" { + el = append(el, fmt.Errorf("invalid value for Strings.s6: %v", v)) + } else { + x.S6 = a.Address + } + } + x.S7 = norm.NFC.String(x.S7) + if v := x.S7; true { + if u, err := url.Parse(v); err != nil { + el = append(el, fmt.Errorf("invalid value for Strings.s7: %v, %w", v, err)) + } else if !u.IsAbs() { + el = append(el, fmt.Errorf("invalid value for Strings.s7: %v", v)) + } else { + x.S7 = u.String() + } + } + x.S8 = norm.NFC.String(x.S8) + if v := x.S8; true { + if !validate.E164Pattern.MatchString(v) { + el = append(el, fmt.Errorf("invalid value for Strings.s8: %v", v)) + } else if len(v)-strings.Count(v, "-") > 16 { + el = append(el, fmt.Errorf("invalid value for Strings.s8: %v", v)) + } + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +func (x *Maps) Validate() error { + var el []error + if len(x.Map1) > 0 { + m := make(map[string]int32) + for k, v := range x.Map1 { + m[norm.NFC.String(k)] = v + } + x.Map1 = m + } + if len(x.Map1) < 1 { + el = append(el, fmt.Errorf("too few items in Maps.map1")) + } + for _, v := range x.Map1 { + if v <= 3 { + el = append(el, fmt.Errorf("invalid value for Maps.map1: %v", v)) + } + } + if len(x.Map2) > 0 { + m := make(map[string]*timestamppb.Timestamp) + for k, v := range x.Map2 { + if err := validate.CallValidate(v); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + m[norm.NFC.String(k)] = v + } + x.Map2 = m + } + for _, v := range x.Map2 { + if v == nil { + el = append(el, fmt.Errorf("values of Maps.map2 are required")) + } + } + if len(x.Map3) > 0 { + m := make(map[uint32]string) + for k, v := range x.Map3 { + m[k] = norm.NFC.String(v) + } + x.Map3 = m + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +func (x *Enums) Validate() error { + var el []error + if v := x.E1; true { + if v == Enums_Enum(0) { + el = append(el, fmt.Errorf("invalid value for Enums.e1: %v", v)) + } + } + if v := x.E2; true { + if _, ok := Enums_Enum_name[int32(v)]; !ok { + el = append(el, fmt.Errorf("invalid value for Enums.e2: %v", v)) + } + } + if v := x.E3; true { + if v == Enums_Enum(0) { + el = append(el, fmt.Errorf("invalid value for Enums.e3: %v", v)) + } + if _, ok := Enums_Enum_name[int32(v)]; !ok { + el = append(el, fmt.Errorf("invalid value for Enums.e3: %v", v)) + } + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +func (x *Oneofs) Validate() error { + var el []error + switch v := x.O1.(type) { + case *Oneofs_Int32: + if v := v.Int32; true { + if v > -3 { + el = append(el, fmt.Errorf("invalid value for Oneofs.int32: %v", v)) + } + } + case *Oneofs_String_: + v.String_ = norm.NFC.String(v.String_) + } + if x.O2 == nil { + el = append(el, fmt.Errorf("a value is required for Oneofs.o2")) + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} + +func (x *Composed) Validate() error { + var el []error + if v := x.Ignored; true { + if v == nil { + el = append(el, fmt.Errorf("a value is required for Composed.ignored")) + } + if v != nil { + if err := validate.CallValidate(v); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + } + } + if v := x.Scalars; true { + if v != nil { + if err := validate.CallValidate(v); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + } + } + for _, v := range x.Maps { + if v != nil { + if err := validate.CallValidate(v); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + } + } + for _, v := range x.Enums { + if v == nil { + el = append(el, fmt.Errorf("a value is required for Composed.enums")) + } + if v != nil { + if err := validate.CallValidate(v); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + } + } + + if err := validate.CallValidateCustom(x); err != nil { + if v, ok := err.(interface{ Unwrap() []error }); ok { + el = append(el, v.Unwrap()...) + } else { + el = append(el, err) + } + } + + if len(el) == 0 { + return nil + } + return errors.Join(el...) +} diff --git a/examples/validation_test.go b/examples/validation_test.go new file mode 100644 index 0000000..402bdf6 --- /dev/null +++ b/examples/validation_test.go @@ -0,0 +1,31 @@ +package examples_test + +import ( + "testing" + + "github.com/cybozu/protobuf/cybozu/validate" + "github.com/cybozu/protobuf/examples" + "github.com/stretchr/testify/assert" +) + +func TestValidation(t *testing.T) { + tests := []struct { + name string + valid bool + message any + }{ + {"ignored", true, &examples.Ignored{}}, + } + + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { + err := validate.CallValidate(tt.message) + if tt.valid { + assert.NoError(t, err) + } else { + assert.Error(t, err) + } + }) + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..742f4b6 --- /dev/null +++ b/go.mod @@ -0,0 +1,15 @@ +module github.com/cybozu/protobuf + +go 1.20 + +require ( + github.com/stretchr/testify v1.8.2 + golang.org/x/text v0.8.0 + google.golang.org/protobuf v1.28.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..0e56ca2 --- /dev/null +++ b/go.sum @@ -0,0 +1,27 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=